第三章 安装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开机启动设置:链接

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。