php中mysql,mysqli,mysqlnd,pdo究竟是什麼php
http://blog.csdn.net/u013785951/article/details/60876816
查看編譯參數 http://ask.apelearn.com/question/1295mysql
[root@yong-02 src]# wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2
[root@yong-02 src]# tar -xjvf php-5.6.32.tar.bz2
[root@yong-02 src]# cd php-5.6.32/
[root@yong-02 src]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/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-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
configure: error: xml2-config not found. Please check your libxml2 installation.
configure: error: Cannot find OpenSSL's <evp.h>
[root@yong-02 php-5.6.32]# yum install -y openssl-devel
configure: error: Please reinstall the BZip2 distribution
[root@yong-02 php-5.6.32]# yum install bzip2-devel
configure: error: jpeglib.h not found.
[root@yong-02 php-5.6.32]# yum install -y libjpeg-devel
configure: error: png.h not found.
[root@yong-02 php-5.6.32]# yum install -y libpng-devel
configure: error: freetype-config not found.
[root@yong-02 php-5.6.32]# yum install -y freetype-devel
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
先安裝 [root@yong-02 php-5.6.32]# yum install -y epel-release 再安裝 [root@yong-02 php-5.6.32]# yum install -y libmcrypt-devel
[root@yong-02 php-5.6.32]# echo $? 0
[root@yong-02 php-5.6.32]# make && make install
echo$? 顯示「0」 這樣成功安裝好PHP5了linux
[root@yong-02 php-5.6.32]# ls /usr/local/php/ bin etc include lib php
[root@yong-02 php-5.6.32]# ls /usr/local/php/bin/ pear peardev pecl phar phar.phar php php-cgi php-config phpize [root@yong-01 php-5.6.32]# du -sh /usr/local/php/bin/php //查看核心二進制文件大小 36M /usr/local/php/bin/php
[root@yong-02 php-5.6.32]# du -sh /usr/local/apache2/modules/libphp5.so 36M /usr/local/apache2/modules/libphp5.so
[root@yong-02 php-5.6.32]# /usr/local/php/bin/php -m //查看php加載的模塊 [PHP Modules] bz2 Core ctype date dom ereg exif fileinfo filter gd hash iconv json libxml mbstring mcrypt mysql mysqli openssl pcre PDO pdo_mysql pdo_sqlite Phar posix Reflection session SimpleXML soap sockets SPL sqlite3 standard tokenizer xml xmlreader xmlwriter zlib [Zend Modules] [root@hf-01 php-5.6.30]#
[root@yong-02 php-5.6.32]# /usr/local/apache2/bin/httpd -M AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::c44:f02d:4192:8d42. Set the 'ServerName' directive globally to suppress this message Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_event_module (static) authn_file_module (shared) authn_core_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) access_compat_module (shared) auth_basic_module (shared) reqtimeout_module (shared) filter_module (shared) mime_module (shared) log_config_module (shared) env_module (shared) headers_module (shared) setenvif_module (shared) version_module (shared) unixd_module (shared) status_module (shared) autoindex_module (shared) dir_module (shared) alias_module (shared) php5_module (shared)
[root@yong-02 php-5.6.32]# ls -l /usr/local/apache2/modules/libphp5.so -rwxr-xr-x. 1 root root 37743064 5月 25 23:24 /usr/local/apache2/modules/libphp5.so [root@yong-02 php-5.6.32]# du -sh !$ du -sh /usr/local/apache2/modules/libphp5.so 36M /usr/local/apache2/modules/libphp5.so
[root@yong-02 php-5.6.32]# vim /usr/local/apache2/conf/httpd.conf 去搜索php5.so,會發現自動增長了一行 LoadModule php5_module modules/libphp5.so 若想使用文件中的那一個模塊,將前面的 # 號去除便可使用 若想不使用哪一個模塊,只須要加一個 # 號便可
[root@yong-02 ~]# /usr/local/php/bin/php -i |less 能夠看到 Configuration File (php.ini) Path => /usr/local/php/etc //configurtion 的配置路徑 Loaded Configuration File => (none) /這些都沒有加載任何東西,由於 /usr/local/php/etc 目錄是空的
[root@yong-02 php-5.6.32]# cp php.ini-production /usr/local/php/etc/php.ini
[root@yong-02 php-5.6.32]# /usr/local/php/bin/php -i |less 這裏會看到加載了路徑 Loaded Configuration File => /usr/local/php/etc/php.ini
[root@yong-02 php-5.6.30]# cd /usr/local/src/
[root@yong-02 src]# wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
[root@yong-02 src]# ls apr-1.6.3 httpd-2.4.33 php-5.6.32.tar.bz2 apr-1.6.3.tar.gz httpd-2.4.33.tar.gz php-7.1.6 apr-util-1.6.1 mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz php-7.1.6.tar.bz2 apr-util-1.6.1.tar.bz2 php-5.6.32 [root@yong-02 src]# tar jxvf php-7.1.6.tar.bz2 //解壓php7.1版本
[root@yong-02 src]# cd php-7.1.6/ [root@yong-02 php-7.1.6]#
[root@yong-02 php-7.1.6]# ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2/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-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
[root@yong-02 php-7.1.6]# make && make install
[root@yong-02 php-7.1.6]# ls /usr/local/apache2/modules/libphp7.so /usr/local/apache2/modules/libphp7.so [root@yong-02 php-7.1.6]# du -sh !$ //查看php7大小 du -sh /usr/local/apache2/modules/libphp7.so 37M /usr/local/apache2/modules/libphp7.so
[root@yong-02 php-7.1.6]# /usr/local/php7/bin/php -m [PHP Modules] bz2 Core ctype date dom exif fileinfo filter gd hash iconv json libxml mbstring mcrypt mysqli openssl pcre PDO pdo_mysql pdo_sqlite Phar posix Reflection session SimpleXML soap sockets SPL sqlite3 standard tokenizer xml xmlreader xmlwriter zlib [Zend Modules] [root@hf-01 php-7.1.6]#
[root@yong-02 php-7.1.6]# /usr/local/apache2/bin/apachectl -M AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::c44:f02d:4192:8d42. Set the 'ServerName' directive globally to suppress this message Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_event_module (static) authn_file_module (shared) authn_core_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) access_compat_module (shared) auth_basic_module (shared) reqtimeout_module (shared) filter_module (shared) mime_module (shared) log_config_module (shared) env_module (shared) headers_module (shared) setenvif_module (shared) version_module (shared) unixd_module (shared) status_module (shared) autoindex_module (shared) dir_module (shared) alias_module (shared) php5_module (shared) php7_module (shared)
[root@yong-02 php-7.1.6]# vim /usr/local/apache2/conf/httpd.conf 搜索php5.so,會看到有兩行 LoadModule php5_module modules/libphp5.so LoadModule php7_module modules/libphp7.so 想使用哪一個php,就在另外一個前面加 # 號註釋掉,而後保存