PHP之编译安装

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-fpm
Usage: /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

 

你可能感兴趣的:(mysql,软件包)