首页 > 代码库 > PHP 编译安装

PHP 编译安装

PHP的安装
 
===============
安装PHP
> wget http://cn2.php.net/get/php-7.1.6.tar.gz
> tar zxvf php-7.1.6.tar.gz
> ./configure --help|grep --with // 查看相关模块
// 连接 :http://www.cnblogs.com/HKUI/p/5137115.html
> ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring  --enable-opcache  --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip
// 连接:http://www.jb51.net/article/55709.htm
注意:如果报错、请安装如下的PHP依赖包、然后再次执行上面的安装PHP
> yum install gcc gcc-c++  make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libxslt libxslt-devel
出现以下、PHP测试存在特性;
Thank you for using PHP.
然后编译、安装PHP
> make && make install
> cp /usr/local/src/php-7.1.6/php.ini-production /usr/local/php/etc
> cd /usr/local/php/etc/
> cp php.ini-production php.ini
> cp php-fpm.conf.default php-fpm.conf
然后修改配置文件
> vim php.ini
// 修改内容如下:
// date.timezone = PRC
// short_open_tag = On
> vim php-fpm.conf
// 修改内容如下:
// pid = run/php-fpm.pid
// error.log = log/php-fpm.log
> cd /usr/local/php/sbin/
> ./php-fpm
// 不报错、就说明启动成功了

PHP 编译安装