ITPub博客

首页 > IT职业 > IT职场 > PHP之编译安装

PHP之编译安装

IT职场 作者:zhjhome 时间:2021-09-09 09:22:19 0 删除 编辑

1.安装php所需的软件包

 


[root@zhu1 ~]# yum -y install libjpeg libjpeg-* libpng libpng-* libmcrypt libmcrypt-* fteetype freetype-* zlib zlib-* bzip2 bzip2-* ncurses ncurses-* libxml2 libxml2-*

2.解压,打补丁,编译,安装

 


[root@zhu1 ~]# tar zxvf php-5.2.17.tar.gz[root@zhu1 ~]# gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1[root@zhu1 ~]# ./configure --prefix=/opt/php --with-config-file-path=/opt/php/etc --with-mysql=/opt/mysql/  --with-mysqli=/opt/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-sockets  --enable-gd-native-ttf --enable-bcmath  --enable-mbstring  --with-gettext  --enable-fpm --enable-fastcgi[root@zhu1 ~]# make && make install

3.创建php.ini配置文件

 


[root@zhu1 php-5.2.17]# cp php.ini-dist /opt/php/etc/php.ini

4.配置php-fpm.conf

该配置文件的用户名和组必须和nginx.conf配置文件中的用户和组相同

5.启动php-fpm

 


[root@zhu1 etc]# /opt/php/sbin/php-fpmUsage: /opt/php/sbin/php-fpm {start|stop|quit|restart|reload|logrotate}[root@zhu1 etc]# /opt/php/sbin/php-fpm start

6.整合nginx和php

前面


location ~ .php$ {root           html;fastcgi_pass   127.0.0.1:9000;fastcgi_index  index.php;fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;include        fastcgi_params;}在/opt/nginx/conf/nginx.conf配置文件中找到上面该段,去掉前面的注释,并修改$document_root 这个地方

7.启动nginx

 


[root@zhu1 etc]# /opt/nginx/sbin/nginx

 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2530/viewspace-2809753/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: python笔记一
请登录后发表评论 登录
全部评论

注册时间:2019-08-16

  • 博文量
    102
  • 访问量
    951