ساختن php از منبع بسیار آسان است و این باعث افزایش چشمگیر کارایی و ثبات خواهد شد. برای ساختن از مبدأ باید این مرحله آموزش را به صورت مرحله به مرحله دنبال کنید تا به نصب نسخه php مورد نظر خود برسید. نصب نرم افزار php در راه اندازی Lamp و Lemp یکی از اقدامات ضروری است .
مرحله اول : نصب برنامه های پیش فرض طبق دستور زیر
yum -y install gcc make gcc-c++ cpp kernel-headers.x86_64 libxml2-devel openssl-devel bzip2-devel libjpeg-devel libpng-devel freetype-devel openldap-devel postgresql-devel aspell-devel net-snmp-devel libxslt-devel libc-client-devel icu libicu libicu-devel gmp-devel curl-devel libmcrypt-devel pcre-devel sqlite-devel db4-devel enchant-devel libXpm-devel mysql-devel readline-devel libedit-devel recode-devel libtidy-devel libtool-ltdl-devel
مرحله دوم : نصب php 7.0
rm -rf /usr/local/php-5-6
mkdir -p /usr/local/php-5-6
cd /usr/local/php-5-6
wget http://php.net/distributions/php-5.6.40.tar.gz
tar zxvf php-5.6.40.tar.gz
cd php-5.6.40
./configure –with-config-file-path=/usr/local/php –with-config-file-scan-dir=/usr/local/php/php.d –with-zlib –enable-soap –with-mysql-sock=/var/lib/mysql/mysql.sock –with-pspell –enable-wddx –with-tidy –enable-exif –enable-phar –enable-bcmath –enable-calendar –with-curl –with-iconv –with-mysql –with-mysqli –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-mcrypt –with-gettext –with-xsl –with-xmlrpc –with-pdo-mysql=mysqlnd –enable-posix –enable-ftp –with-openssl –enable-mbstring –with-kerberos –with-bz2 –enable-sockets –enable-zip –with-gd –with-jpeg-dir=/usr –with-freetype-dir=/usr –with-png-dir=/usr –enable-gd-native-ttf –with-pcre-regex –with-libdir=lib64 –enable-shmop –enable-intl –with-icu-dir=/usr –with-imap –with-imap-ssl –with-litespeed –with-pgsql=/usr/lib64/pgsql –with-pdo-pgsql
make && make install
برای فعال کردن Fpm طبق دستور زیر عمل نمایید :
./configure –with-config-file-path=/usr/local/php –with-config-file-scan-dir=/usr/local/php/php.d –with-zlib=/usr –enable-mbstring –enable-zip –enable-bcmath –enable-pcntl –enable-ftp –enable-exif –enable-calendar –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-wddx –with-tidy –with-curl –with-mcrypt –with-iconv –with-gmp –with-pspell –with-gd –with-jpeg-dir=/usr –with-freetype-dir=/usr –with-png-dir=/usr –enable-gd-native-ttf –enable-gd-jis-conv –with-zlib-dir=/usr –with-xpm-dir=/usr –with-openssl –with-pdo-mysql=/usr –with-gettext=/usr –with-bz2=/usr –with-mysqli –enable-soap –enable-phar –with-xsl –with-xmlrpc –with-kerberos –enable-posix –enable-sockets –with-pcre-regex –with-libdir=lib64 –with-mysql-sock=/var/lib/mysql/mysql.sock –enable-shmop –enable-intl –with-icu-dir=/usr –with-imap –with-imap-ssl –with-litespeed –with-pgsql=/usr/lib64/pgsql –with-pdo-pgsql –enable-fpm
make && make install
نصب php 7.1
rm -rf /usr/local/php-7-1
mkdir -p /usr/local/php-7-1
cd /usr/local/php-7-1
wget http://php.net/distributions/php-7.1.30.tar.gz
tar zxvf php-7.1.30.tar.gz
cd php-7.1.30
./configure –with-config-file-path=/usr/local/php –with-config-file-scan-dir=/usr/local/php/php.d –with-zlib=/usr –enable-mbstring –enable-zip –enable-bcmath –enable-pcntl –enable-ftp –enable-exif –enable-calendar –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-wddx –with-tidy –with-curl –with-mcrypt –with-iconv –with-gmp –with-pspell –with-gd –with-jpeg-dir=/usr –with-freetype-dir=/usr –with-png-dir=/usr –enable-gd-native-ttf –enable-gd-jis-conv –with-zlib-dir=/usr –with-xpm-dir=/usr –with-openssl –with-pdo-mysql=/usr –with-gettext=/usr –with-bz2=/usr –with-mysqli –enable-soap –enable-phar –with-xsl –with-xmlrpc –with-kerberos –enable-posix –enable-sockets –with-pcre-regex –with-libdir=lib64 –with-mysql-sock=/var/lib/mysql/mysql.sock –enable-shmop –enable-intl –with-icu-dir=/usr –with-imap –with-imap-ssl –with-litespeed –with-pgsql=/usr/lib64/pgsql –with-pdo-pgsql
make && make install
برای کانفیگ Fpm طبق دستور زیر عمل کنید :
./configure –with-config-file-path=/usr/local/php –with-config-file-scan-dir=/usr/local/php/php.d –with-zlib=/usr –enable-mbstring –enable-zip –enable-bcmath –enable-pcntl –enable-ftp –enable-exif –enable-calendar –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-wddx –with-tidy –with-curl –with-mcrypt –with-iconv –with-gmp –with-pspell –with-gd –with-jpeg-dir=/usr –with-freetype-dir=/usr –with-png-dir=/usr –enable-gd-native-ttf –enable-gd-jis-conv –with-zlib-dir=/usr –with-xpm-dir=/usr –with-openssl –with-pdo-mysql=/usr –with-gettext=/usr –with-bz2=/usr –with-mysqli –enable-soap –enable-phar –with-xsl –with-xmlrpc –with-kerberos –enable-posix –enable-sockets –with-pcre-regex –with-libdir=lib64 –with-mysql-sock=/var/lib/mysql/mysql.sock –enable-shmop –enable-intl –with-icu-dir=/usr –with-imap –with-imap-ssl –with-litespeed –with-pgsql=/usr/lib64/pgsql –with-pdo-pgsql –enable-fpm
make && make install
نصب php 7.2
rm -rf /usr/local/php-7-2
mkdir -p /usr/local/php-7-2
cd /usr/local/php-7-2
wget http://php.net/distributions/php-7.2.19.tar.gz
tar zxvf php-7.2.19.tar.gz
cd php-7.2.19
./configure –with-config-file-path=/usr/local/php –with-config-file-scan-dir=/usr/local/php/php.d –with-zlib=/usr –enable-mbstring –enable-zip –enable-bcmath –enable-pcntl –enable-ftp –enable-exif –enable-calendar –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-wddx –with-tidy –with-curl –with-iconv –with-gmp –with-pspell –with-gd –with-jpeg-dir=/usr –with-freetype-dir=/usr –with-png-dir=/usr –enable-gd-jis-conv –with-zlib-dir=/usr –with-xpm-dir=/usr –with-openssl –with-pdo-mysql=/usr –with-gettext=/usr –with-bz2=/usr –with-mysqli –enable-soap –enable-phar –with-xsl –with-xmlrpc –with-kerberos –enable-posix –enable-sockets –with-pcre-regex –with-libdir=lib64 –with-mysql-sock=/var/lib/mysql/mysql.sock –enable-shmop –enable-intl –with-icu-dir=/usr –with-imap –with-imap-ssl –with-litespeed –with-pgsql=/usr/lib64/pgsql –with-pdo-pgsql
make && make install
برای کانفیگ Fpm مورد نظر طبق دستور زیر عمل نمایید :
./configure –with-config-file-path=/usr/local/php –with-config-file-scan-dir=/usr/local/php/php.d –with-zlib=/usr –enable-mbstring –enable-zip –enable-bcmath –enable-pcntl –enable-ftp –enable-exif –enable-calendar –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-wddx –with-tidy –with-curl –with-iconv –with-gmp –with-pspell –with-gd –with-jpeg-dir=/usr –with-freetype-dir=/usr –with-png-dir=/usr –enable-gd-jis-conv –with-zlib-dir=/usr –with-xpm-dir=/usr –with-openssl –with-pdo-mysql=/usr –with-gettext=/usr –with-bz2=/usr –with-mysqli –enable-soap –enable-phar –with-xsl –with-xmlrpc –with-kerberos –enable-posix –enable-sockets –with-pcre-regex –with-libdir=lib64 –with-mysql-sock=/var/lib/mysql/mysql.sock –enable-shmop –enable-intl –with-icu-dir=/usr –with-imap –with-imap-ssl –with-litespeed –with-pgsql=/usr/lib64/pgsql –with-pdo-pgsql –enable-fpm
make && make install
مرحله سوم :
سرور apache را مجدداً راه اندازی کنید و نسخه php را از طریق دستور زیر بررسی کنید .
service httpd restart
php -v
نوین هاست ارائه دهنده انواع خدمات هاست , سرور مجازی , سرور اختصاصی , سرور ابری و …. در کشور با بهترین کیفیت و خدمات پس از فروش .
rm -rf /usr/local/php-5-6 mkdir -p /usr/local/php-5-6 cd /usr/local/php-5-6 wget http://php.net/distributions/php-5.6.40.tar.gz tar zxvf php-5.6.40.tar.gz cd php-5.6.40 ./configure --with-config-file-path=/usr/local/php --with-config-file-scan-dir=/usr/local/php/php.d --with-zlib --enable-soap --with-mysql-sock=/var/lib/mysql/mysql.sock --with-pspell --enable-wddx --with-tidy --enable-exif --enable-phar --enable-bcmath --enable-calendar --with-curl --with-iconv --with-mysql --with-mysqli --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-mcrypt --with-gettext --with-xsl --with-xmlrpc --with-pdo-mysql=mysqlnd --enable-posix --enable-ftp --with-openssl --enable-mbstring --with-kerberos --with-bz2 --enable-sockets --enable-zip --with-gd --with-jpeg-dir=/usr --with-freetype-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-pcre-regex --with-libdir=lib64 --enable-shmop --enable-intl --with-icu-dir=/usr --with-imap --with-imap-ssl --with-litespeed --with-pgsql=/usr/lib64/pgsql --with-pdo-pgsql make && make install