Install PHP
Resolving dependencies
# Please configure the Yum source (System installation source and Epel source) to execute the following command: Yum-y groupinstall "Desktop Platform Development" Yum-y Install Bzip2-devel Libmcrypt-devel Mhash-devel
Compiling and installing php-5.4.26
Tar XF php-5.4.26.tar.bz2cd php-5.4.26./configure--prefix=/usr/local/php--with-mysql=mysqlnd--with-pdo-mysql= Mysqlnd--with-mysqli=mysqlnd--with-openssl--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png-dir-- With-zlib--with-libxml-dir=/usr--enable-xml --enable-sockets--enable-fpm--with-mcrypt -- With-config-file-path=/etc--WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D--with-bz2makemake testmake intall# provides configuration file for PHP CP Php.ini-production/etc/php.ini
Configure PHP-FPM
# provide SYSV init script for php-fpm and add it to the list of services: CP sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpmchmod +X/ETC/RC.D/INIT.D /php-fpmchkconfig--add php-fpmchkconfig php-fpm on# provides configuration files for php-fpm: cp/usr/local/php/etc/php-fpm.conf.default/usr/ local/php/etc/php-fpm.conf# Edit PHP-FPM Profile: # vim/usr/local/php/etc/php-fpm.conf# Configure FPM related options for the values you need and enable the PID file Pm.max _children = 50pm.start_servers = 5pm.min_spare_servers = 2pm.max_spare_servers = 8pid =/usr/local/php/var/run/ Php-fpm.pid# can then start php-fpm: Service PHP-FPM start# Use the following command (if the command output has several PHP-FPM processes to indicate that the boot was successful) PS aux | grep php-fpm# By default, FPM listens on port 9000 of 127.0.0.1, and can use the following command to verify that it is already listening on the appropriate socket. NETSTAT-TNLP | grep php-fpmtcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 689/php-fpm
Configure HTTPD
Enabling the relevant modules for httpd
# after HTTPD 2.4 has been dedicated to a module for the implementation of FASTCGI, this module is mod_proxy_fcgi.so, it is actually as an extension of the mod_proxy.so module, so the two modules are loaded LoadModule proxy_ Module Modules/mod_proxy.soloadmodule proxy_fcgi_module modules/mod_proxy_fcgi.so
Configure the virtual host to support the use of fastcgi
# When using a virtual host, you need to first disable the DocumentRoot entry for the master profile and enable the Httpd-vhosts.conf profile # simultaneously listening on 8080 ports vi/ect/httpd/httpd.conf# documentroot "/ Usr/local/apache/htdocs "~~~# Virtual hostsinclude/etc/httpd/extra/httpd-vhosts.conf~~~listen 8080================ ===========# first borrow phpMyAdmin's virtual host setup instructions vi/etc/httpd/extra/httpd-vhosts.conf<virtualhost *:8080> DocumentRoot "/www/phpmyadmin.com" ServerName phpmyadmin.com errorlog "Logs/phpmyadmin.com-error_log" customlog "Logs/phpmyadmin.com-access_log" Common # Close forward proxy proxyrequests off # Send a file request ending in. php to the PHP-FPM process, php-fpm need to know at least the directory and URI that is running proxypassmatch ^/(. *\.php) $ fcgi://192.168.1.111:9000/www/ phpmyadmin.com/$1 <directory "/www/phpmyadmin.com" > Options Indexes followsymlinks allowoverride None Require all granted </Directory></VirtualHost>
Edit httpd configuration file
# allow Apache to recognize PHP-formatted pages and support PHP-formatted home page # vim/etc/httpd/httpd.conf# Add the following two lines AddType application/x-httpd-php . php AddType application/x-httpd-php-source . phps# to DirectoryIndex index.html, modified to DirectoryIndex index.php index.html
Edit Test Page
# dynamic content is placed on the PHP server, so the following files on 192.168.1.111 # vi/www/phpmyadmin/index.php<?php$link = mysql_connect (' 192.168.1.112 ', ' PMA ', ' pma123 '), if ($link) echo "Success ..."; Elseecho "Failure ..."; Mysql_close ();? >
Access test
# Browser Test Access http://192.168.1.110:8080
Original http://www.cnblogs.com/xiaocen/p/3712486.html
Lamp Architecture PHP-FPM Server turn