Install PHP extension software
# Ha Shu function library
[[Email protected] ~ Mhash-0.9.9.9.tar.gz] # tar-zxvf
[[Email protected] mhash-0.9.9.9] # cd mhash-0.9.9.9
[[Email protected] mhash-0.9.9.9] #./configure
[[Email protected] mhash-0.9.9.9] # Make
[[Email protected] mhash-0.9.9.9] # make install
# Process conversion between various Chinese encodings
[[Email protected] ~ Libiconv-1.13.tar.gz] # tar-zxvf
[[Email protected] libiconv-1.13] # cd libiconv-1.13
[[Email protected] libiconv-1.13] #./configure
[[Email protected] libiconv-1.13] # Make
[[Email protected] libiconv-1.13] # make install
[[Email protected] libmcrypt-2.5.8] # tar-zxvf libmcrypt-2.5.8.tar.gz
[[Email protected] libmcrypt-2.5.8] # cd libmcrypt-2.5.8
[[Email protected] libmcrypt-2.5.8] #./configure
[[Email protected] libmcrypt-2.5.8] # Make
[[Email protected] libmcrypt-2.5.8] # make install
[[Email protected] libmcrypt-2.5.8] # ldconfig-V
[[Email protected] libmcrypt-2.5.8] # cd libltdl
[[Email protected] libltdl] #./configure -- With-gmetad -- enable-gexec
-- Enable-ltdl-install
[[Email protected] libltdl] # Make & make install
# Linking database files
[[Email protected] ~ ] # Ln-SV/usr/local/lib/libmcrypt */usr/lib/
[[Email protected] ~ ] # Ln-SV/usr/local/lib/libmhash. */usr/lib/
# Link to the new database
[[Email protected] ~ ] # Ldconfig-V
Install PHP
14
[Email protected] ~] # Tar-zxvf php-5.4.9.tar.gz
[[Email protected] ~] # Cd php-5.4.9
[[Email protected] php-5.4.9] #./configure \
-- Prefix =/usr/local/php5nginx \
-- With-config-file-Path =/usr/local/php5nginx/etc \
-- With-mysql =/usr/local/MySQL \
-- With-mysqli =/usr/local/MySQL/bin/mysql_config \
-- With-iconv-Dir =/usr/local \
-- With-FreeType-dir -- With-JPEG-Dir \
-- With-PNG-dir -- With-zlib -- With-libxml-Dir =/usr \
-- Enable-XML -- disable-rpath -- enable-bcmath \
-- Enable-shmop -- enable-sysvsem \
-- Enable-inline-optimization -- With-curl -- With-curlwrappers \
-- Enable-mbregex -- enable-FPM -- enable-mbstring \
-- With-mcrypt -- With-Gd -- enable-Gd-native-TTF \
-- With-OpenSSL -- With-mhash -- enable-pcntl \
-- Enable-sockets -- With-LDAP-sasl \
-- With-XMLRPC -- enable-zip -- enable-soap \
[[Email protected] php-5.4.9] # Make zend_extra_libs = '-liconv'
[[Email protected] php-5.4.9] # make install
[[Email protected] php-5.4.9] # cp PHP. ini-production \
>/Usr/local/php5nginx/etc/PHP. ini
Configure fast-CGI
[[Email protected] ~] # Cd/usr/local/php5nginx/etc/
[[Email protected] etc] # cp php-fpm.conf.default php-fpm.conf
[[Email protected] etc] # Vim php-fpm.conf
# Modify the content
[Global]
PID = run/php-fpm.pid
Error_log = log/php-fpm.log
Log_level = Error
Daemonize = Yes
[Www]
User = WWW
Group = WWW
Listen = 127.0.0.1: 9000
PM = dynamic
PM. max_children = 32
PM. start_servers = 15
PM. min_spare_servers = 5
PM. max_spare_servers = 32
Start PHP-FPM
[[Email protected] ~] # Cd php-5.4.9/SAPI/FPM/
[[Email protected] FPM] # cp init. d. php-FPM/etc/rc. d/init. d/PHP-FPM
[[Email protected] FPM] # chmod + x/etc/rc. d/init. d/PHP-FPM
[[Email protected] FPM] # chkconfig -- add PHP-FPM
[[Email protected] FPM] # service PHP-fpm start | restart | reload | restart
[[Email protected] FPM] # ps aux | grep PHP-FPM
Edit the nginx. conf file
[[Email protected] ~ ] # Vim/usr/local/nginx/CONF/nginx. conf
Location /{
Root HTML;
Index index. php index.html index.htm; // Add the index. php Option
}
Location ~ \. Php $ {
Root HTML;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param script_filename/scripts $ fastcgi_script_name; // fast-CGI parameter file
Include fastcgi_params;
}
Edit the fastcgi_params File
[[Email protected] ~ ] # Vim/usr/local/nginx/CONF/fastcgi_params
Fastcgi_param gateway_interface cgi/1.1;
Fastcgi_param server_software nginx;
......
Fastcgi_param content_length $ content_length;
Fastcgi_param script_filename $ document_root $ fastcgi_script_name;
Fastcgi_param script_name $ fastcgi_script_name;
......
Fastcgi_param document_root $ document_root;
Test
[[Email protected] ~] # Pkill-9 nginx
[[Email protected] ~] #/Usr/local/nginx/sbin/nginx
[[Email protected] ~] #/Etc/rc. d/init. d/PHP-FPM restart
[[Email protected] HTML] # Vim index. php
<? PHP
Phpinfo ();
?>
[[Email protected] HTML] #
Test Database Link
<? PHP
$ Links = mysql_connect ("localhost", "root ","");
If ($ links ){
Echo "link dB OK !!! ";
}
Else {
Echo "link dB No !!! ";
}
?>
[[Email protected] HTML] #