11.10/11.11/11.12 安裝PHP5 11.13 安裝PHP7

11.10/11.11/11.12 安裝PHP5

PHP官網www.php.netphp

當前主流版本爲5.6/7.1mysql

安裝前請安裝sql

yum install -y libxml2-devel openssl openssl-devel bzip2-devel libjpeg-devel libpng-devel
freetype-devel libXpm-devel libmcrypt-develapache

cd /usr/local/src/vim

wget http://cn.php.net/distributions/php-5.6.32.tar.gzphp7

tar xvf php-5.6.32.tar.gzless

cd php-5.6.32socket

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif.net

make && make install cp php.ini-production /usr/local/php/etc/php.inixml

其餘 /usr/local/php5/bin/php -i | less 用-i 可查看php一些信息, 好比編譯參數 /usr/local/php5/bin/php -m 查看php加載的模塊

11.13 安裝PHP7

11.13 安裝PHP7

cd /usr/local/src/

wget http://cn.php.net/distributions/php-7.2.0.tar.gz

tar xvf php-7.2.0.tar.gz

cd php-7.2.0/

./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --enable-soap --enable-mbstring --enable-sockets --enable-exif

make && make install

cp php.ini-production /usr/local/php7/etc/php.ini

其它

php7 ./configure 的時候 已經不用 --with-mysql

/usr/local/php7/bin/php -i | less 用-i 可查看php一些信息, 好比編譯參數

/usr/local/php7/bin/php -m 查看php加載的模塊

ls /usr/local/apache2.4/modules/libphp7.so 可查看php的的模塊,若是安裝過php5和php7 ,會有 libphp7.so和libphp5.so

/usr/local/apache2.4/bin/apachectl -M 查看http加載的模塊, 若是裝過php5和php7, 會同時看到

php7_module (shared) 和 php5_module (shared), 使用哪一個根據本身的需求

vim /usr/local/apache2.4/conf/httpd.conf // 不想用哪一個就把哪一個註釋掉,不註釋掉一個啓動http的時候會出錯

相關文章
相關標籤/搜索