码迷,mamicode.com
首页 > Web开发 > 详细

39.php5安装、php7安装

时间:2018-04-12 02:59:58      阅读:252      评论:0      收藏:0      [点我收藏+]

标签: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编译配置文件中指定了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安装

标签:php5安装   php7安装   

原文地址:http://blog.51cto.com/13569831/2097199

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!