cd /usr/ports/www/apache22-worker-mpm ; make install

cd /usr/ports/lang/php5 ; make install
[x] Build FPM version

cd /usr/ports/lang/php5-extensions/ ; make install

cd /usr/ports/www/mod_fastcgi ; make install

建議fastcgi可以獨立一個設定檔
vi /usr/local/etc/apache22/extra/php-fpm.conf
<IfModule prefork.c>
LoadModule php5_module libexec/apache22/libphp5.so
AddType application/x-httpd-php .php .html
AddType application/x-httpd-php-source .phps
</IfModule>

<IfModule worker.c>
FastCGIExternalServer /usr/local/sbin/php-fpm -socket /tmp/php-fpm.sock -idle-timeout 900
AddHandler php-fastcgi .php
Action php-fastcgi /usr/local/sbin/php-fpm.fcgi
ScriptAlias /usr/local/sbin/php-fpm.fcgi /usr/local/sbin/php-fpm

<Directory /usr/local/sbin >
Options ExecCGI FollowSymLinks
SetHandler fastcgi-script
Order allow,deny
Allow from all
</Directory>
</IfModule>

DirectoryIndex index.php index.html

編輯apache設定檔
vi /usr/local/etc/apache22/httpd.conf
如果有Load php module的話,把他註解掉,保留LoadModule fastcgi_module
LoadModule fastcgi_module libexec/apache22/mod_fastcgi.so
#LoadModule php5_module libexec/apache22/libphp5.so

Include etc/apache22/extra/php-fpm.conf

編輯php-fpm.conf
listen = /tmp/php-fpm.sock
listen.owner = www
listen.group = www
listen.mode = 0660

編輯/etc/rc.conf
apache22_enable="YES"
php_fpm_enable="YES"

重開機或手動啟動service
/usr/local/etc/rc.d/php-fpm start
/usr/local/etc/rc.d/apache22 start

 

 

, , , , ,

helloworld 發表在 痞客邦 PIXNET 留言(0) 人氣()