第三章 安装php

安装PHP:

[root@CentosMain app]# yum -y install zlib-devel libxml2 libxml2-devel libjpeg-devel libiconv-devel freetype-devel libpng-devel gd gd-devel openssl openssl-devel curl-devel libxslt-devel libmcrypt libmcrypt-devel mhash mcrypt bzip2-devel bzip2 ncurses-devel  php-mcrypt  libmcrypt  libmcrypt-devel
[root@CentosMain ~]# tar -xvf php-5.6.32.tar.gz -C /app
[root@CentosMain ~]# cd /app/php-5.6.32
[root@CentosMain php-5.6.32]#  ./configure --prefix=/app/php --enable-fpm --enable-mysqlnd --enable-zip --enable-mbstring --enable-exif --with-fpm-user=nginx --with-fpm-group=nginx --with-openssl --with-mysql --with-mysqli --with-curl --with-zlib --with-gd --with-mcrypt --with-jpeg-dir --with-freetype-dir --enable-bcmath --enable-sockets --with-gettext
[root@CentosMain php-5.6.32]#  make
[root@CentosMain php-5.6.32]#  make test
[root@CentosMain php-5.6.32]#  make install

配置文件修改:

[root@CentosMain etc]# cd /app/php/etc
[root@CentosMain etc]# cp php-fpm.conf.default php-fpm.conf
[root@CentosMain etc]# cd /app/php-5.6.32/
[root@CentosMain php-5.6.32]# cp php.ini-production /app/php/lib/php.ini
[root@CentosMain php-5.6.32]# cd /app/php-5.6.32/sapi/fpm
[root@CentosMain fpm]# cp init.d.php-fpm /etc/init.d/php-fpm
[root@CentosMain fpm]# chmod +x /etc/init.d/php-fpm

修改/app/php/lib目录下php.ini文件:

date.timezone = Asia/Shanghai
post_max_size = 32M
max_execution_time = 300
max_input_time = 300
always_populate_raw_post_data = -1

修改nginx的配置文件nginx.conf,以支持php网上参考链接:

第三章 安装php_第1张图片

php开机启动设置:链接

你可能感兴趣的:(第三章 安装php)