nginx安装成功了
下载
wget http://cn2.php.net/distributions/php-5.6.5.tar.gz
解压
tar zxvf php-5.6.5.tar.gz -C /usr/local/bin
安装最基础php模块
libxm
yum -y install libxm
安装php
./configure --prefix=/usr/etc/php --enable-fpm
下面是具体过程
[root@localhost php-5.6.5]# ./configure --prefix=/usr/etc/php --enable-fpm
.........
...........
..........
creating libtool
appending configuration tag "CXX" to libtool
Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating sc
config.status: creating sc
config.status: creating sc
config.status: creating sc
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
编译安装
make
make install
fpm配置文件改名
[root@localhost etc]# cd /usr/etc/php/etc
[root@localhost etc]# ls
pear.conf php-fpm.conf.default php.ini
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# ls
pear.conf php-fpm.conf php-fpm.conf.default php.ini
[root@localhost etc]# vi php-fpm.conf
pid = run/php-fpm.pid #取消前面的分号
然后保存的
设置 php-fpm开机启动
cp /usr/local/bin/php-5.6.5/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm #拷贝php-fpm到启动目录
chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限
chkconfig php-fpm on #设置开机启动
复制php.ini
[root@localhost php-5.6.5]# cp php.ini-production /usr/etc/php/etc/php.ini
[root@localhost php-5.6.5]# cd /usr/etc/php/etc
[root@localhost etc]# ls
pear.conf php.ini
编辑php.ini
[root@localhost etc]# vi php.ini
修改的地方
date.timezone = PRC
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.
;
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_fileinfo.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interba
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Databa
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite3.dll
;extension=php_syba
;extension=php_tidy.dll
;extension=php_xm
;extension=php_xsl.dll
配置nginx支持php
[root@localhost conf]# cd /usr/etc/ngin/conf
[root@localhost conf]# ls
fastcgi.conf koi-win scgi_params
fastcgi.conf.default mime.types scgi_params.default
fastcgi_params mime.types.default uwsgi_params
fastcgi_params.default nginx.conf uwsgi_params.default
koi-utf nginx.conf.default win-utf
[root@localhost conf]# vi nginx.conf
index index.html index.htm index.php; #添加index.php
# pass the PHP sc
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param sc
include fastcgi_params;
}
phpinfo测试的文件也写了
默认防火期firewall也关闭了
请问我还要改哪里
貌似也开启了吧
[root@localhost src]# lsof -i:9000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
php-fpm 21127 root 7u IPv4 333463 0t0 TCP localhost:cslistener (LISTEN)
php-fpm 21128 nobody 0u IPv4 333463 0t0 TCP localhost:cslistener (LISTEN)
php-fpm 21129 nobody 0u IPv4 333463 0t0 TCP localhost:cslistener (LISTEN)
请问我这个是哪里还需要修改呢 查了不少教程 感觉都是一部分的 ~ 求指点~
[root@localhost etc]# lsof -i:9000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
php-fpm 2070 root 7u IPv4 19609 0t0 TCP localhost:cslistener (LISTEN)
php-fpm 2155 nobody 0u IPv4 19609 0t0 TCP localhost:cslistener (LISTEN)
php-fpm 2156 nobody 0u IPv4 19609 0t0 TCP localhost:cslistener (LISTEN)
[root@localhost etc]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 2404 root 6u IPv4 21041 0t0 TCP *:http (LISTEN)
nginx 2405 nobody 6u IPv4 21041 0t0 TCP *:http (LISTEN)
最佳答案
