php中mysql,mysqli,mysqlnd,pdo究竟是什麼 http://blog.csdn.net/u013785951/article/details/60876816php
查看編譯參數 http://ask.apelearn.com/question/1295mysql
cd /usr/local/src
wget http://cn2.php.net/distributions/php-5.6.37.tar.gz
tar -zxvf php-5.6.37.tar.gz
cd php-5.6.37
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-zlib-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl-dir=/usr/include/openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
checking for xml2-config path… configure: error: xml2-config not found. Please check your libxml2 installation.
yum install libxml2-devel -y yum install libxml2 -y
configure:error: cannot find OpenSSL's <evp'h>
export PHP_OPENSSL_DIR=yes
configure:error:please reinstall the BZip2 distribution
yum install bzip2-devel -y
configure:error:jpeglib.h not found
yum install libjpeg-devel -y
png.h not found
yum install libpng-devel
freetype-config not found
yum install freetype-devel -y
mcrypt.h not found please reinstall libmcrypt
yum install libmcrypt-devel -y
cp php.ini-development /usr/local/php/etc/php.ini
/usr/local/php/bin/php -i |less
PHP7和PHP5的安裝大同小異sql
進入/usr/local/src目錄apache
tar jxvf php-7.1.20.tar.bz2php7
cd php-7.1。20app
./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exifless
由於以前裝過PHP5,不少包已經安裝了,因此這一步通常不會報錯。dom
checking whether to build shared libraries... yes checking whether to build static libraries... no creating libtool appending configuration tag "CXX" to libtool Generating files configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP. config.status: creating php7.spec config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/cgi/php-cgi.1 config.status: creating ext/phar/phar.1 config.status: creating ext/phar/phar.phar.1 config.status: creating main/php_config.h config.status: executing default commands configure: WARNING: unrecognized options: --with-freetype [root@localhost php-7.1.20]# echo $? 0
[root@localhost php-7.1.20]# cd /usr/local/apache/modules/ [root@localhost modules]# ls httpd.exp mod_authn_dbm.so mod_cache.so mod_headers.so mod_proxy_ajp.so mod_ratelimit.so mod_socache_shmcb.so libphp5.so
/usr/local/apache2.4/bin/apachectl -M
查看加載的模塊,能夠看到7和5都被加載了。-[root@localhost php-7.1.20]# /usr/local/apache/bin/apachectl -M |grep php AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message php5_module (shared) php7_module (shared)
vi /usr/local/apache/conf/httpd.conf
#LoadModule php5_module modules/libphp5.so LoadModule php7_module modules/libphp7.so
註釋掉5後發現再也不加載PHP5了。socket
[root@localhost php-7.1.20]# /usr/local/apache/bin/apachectl -M |grep php AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message php7_module (shared)