Difference between revisions of "install php with php-fpm"

From WebHostingNeeds.com
Jump to: navigation, search
m
m (Replaced content with "See install php-fpm from source on centos")
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
<pre>
+
See [[install php-fpm from source on centos]]
cd /usr/local/src
 
wget http://php-fpm.org/downloads/php-5.2.8-fpm-0.5.10.diff.gz
 
wget http://us2.php.net/get/php-5.2.8.tar.gz/from/us.php.net/mirror
 
tar -zxvf php-5.2.8.tar.gz
 
gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1
 
cd php-5.2.8
 
mkdir /usr/local/nginx-php
 
 
 
./configure -prefix=/usr/local/nginx-php -enable-fastcgi -enable-fpm -with-mcrypt -with-zlib -enable-mbstring -with-openssl -with-mysql -with-mysqli -with-gd -with-jpeg-dir -enable-gd-native-ttf -without-sqlite -disable-pdo -disable-reflection -with-curl -with-curlwrappers -enable-inline-optimization -disable-debug -disable-ipv6
 
make
 
make install
 
</pre>
 
 
 
Copy php.ini
 
 
 
<pre>
 
cp php.ini-recommended  /usr/local/nginx-php/lib/php/php.ini
 
</pre>
 
 
 
 
 
 
 
I have faced problem with curl, so i install url from source as per [[Install php from source]]
 
 
 
* [[configure: error: XML configuration could not be found]]
 
* [[configure: error: Please reinstall the libcurl distribution]]
 
 
 
 
 
<pre>
 
vi /usr/local/nginx-php/etc/php-fpm.conf
 
</pre>
 
 
 
 
 
Find
 
 
 
<pre>
 
                        Unix user of processes
 
                <!--    <value name="user">nobody</value>                              -->
 
 
 
                        Unix group of processes
 
                <!--    <value name="group">nogroup</value>            -->
 
</pre>
 
 
 
add below
 
 
 
<pre>
 
<value name="user">nginx</value>
 
<value name="group">nginx</value>
 
</pre>
 
 
 
/usr/local/nginx-php/sbin/php-fpm start
 
 
 
<pre>
 
[email protected]:/usr/local/nginx-php/sbin# netstat -an|grep :9000
 
tcp        0      0 127.0.0.1:9000          0.0.0.0:*              LISTEN
 
[email protected]:/usr/local/nginx-php/sbin#
 
</pre>
 
 
 
 
 
== Configuring Nginx ==
 
 
 
Edit nginx.conf
 
 
 
<pre>
 
vi /etc/nginx/nginx.conf
 
</pre>
 
 
 
Find
 
 
 
<pre>
 
        location / {
 
            root  html;
 
            index  index.html index.htm;
 
        }
 
<pre>
 
 
 
Replace with
 
 
 
<pre>
 
        location / {
 
            root  /home/test/html;
 
            index  index.html index.htm index.php;
 
        }
 
 
 
location ~ \.php$ {
 
fastcgi_pass 127.0.0.1:9000;
 
fastcgi_index index.php;
 
fastcgi_param SCRIPT_FILENAME /home/test/html$fastcgi_script_name;
 
include fastcgi_params;
 
}
 
</pre>
 
 
 
Create document root and a test file
 
 
 
<pre>
 
mkdir -p /home/test/html
 
echo "Testing" > /home/test/html/index.html
 
</pre>
 
 
 
 
 
* [[Nginx]]
 

Latest revision as of 10:40, 29 January 2014

See install php-fpm from source on centos