1. 程式人生 > >39.php5安裝、php7安裝

39.php5安裝、php7安裝

php5安裝 php7安裝

PHP官網www.php.net
當前主流版本為5.6/7.1

一、PHP5安裝

 cd /usr/local/src/ 
 wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
 tar zxf php-5.6.30.tar.gz
 cd php-5.6.30
 ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/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
  • php中mysql,mysqli,mysqlnd,pdo到底是什麽
    https://blog.csdn.net/u013785951/article/details/60876816

php編譯配置文件中指定了apache和mysql的路徑,所以說需要先安裝apache和mysql,初次安裝會缺少各種庫文件

技術分享圖片
技術分享圖片
技術分享圖片
技術分享圖片

yum list | grep xml2
yum install -y libxml2-devel.x86_64

configure: error: Cannot find OpenSSL‘s <evp.h>

yum install -y  openssl-devel

基本都是缺少庫文件,相同方法就可以解決問題 安裝 libxxxx-devel 或者 xxx-devel 即可

  • 常缺少的庫文件安裝
    yum install -y libxml2-devel.x86_64
    yum install -y openssl-devel
    yum install -y bzip2-devel
    yum install -y libpng-devel
    yum install -y freetype-devel
    yum install -y epel-release
    yum install -y libmcrypt-devel

    完成之後(記得echo $? 檢查是否成)

    make && make install
    cp php.ini-production  /usr/local/php/etc/php.ini   //復制配置文件
    /usr/local/php/bin/php -i | less     //查看php的配置信息

    技術分享圖片

/usr/local/php/bin/php -m //查看php的擴展,都是靜態的
技術分享圖片

二、PHP7安裝

cd /usr/local/src/ 
 wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
 tar jxvf php-7.1.6.tar.bz2
 cd php-7.1.6
 ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/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
 make && make install
 ls /usr/local/apache2.4/modules/libphp7.so
 cp php.ini-production  /usr/local/php7/etc/php.ini
ls /usr/local/apache2.4/modules/ | grep libphp  //apache需要的就是這兩個擴展文件

技術分享圖片

vim /usr/local/apache2.4/conf/httpd.conf  //查看apache加載了哪些擴展,不需要的直接#註釋掉即可

技術分享圖片

/usr/local/php7/bin/php -i | less  //查看php7的配置相關信息
  • Linux下查看Nginx、Napache、MySQL、PHP的編譯參數的命令如下:
    轉自 http://www.jzyuan.cn/?p=220
    1、nginx編譯參數:
    /usr/local/nginx/sbin/nginx -V
    2、apache編譯參數:
    cat /usr/local/apache/build/config.nice
    3、php編譯參數:
    /usr/local/php/bin/php -i |grep configure
    4、mysql編譯參數:
    cat /usr/local/mysql/bin/mysqlbug|grep configure

39.php5安裝、php7安裝