Hey, Nginx gain popularity because it lightweight and scalability. Here I will provide a short how to set up nginx running php with php5-fpm(fastcgi process manager) in ubuntu 12.04
#apt-get install nginx php-fpm
Config file for php is at /etc/php5/fpm/pool.d/
This you can control how php process run, tcp or unix socket
The config file for nginx to run php is you need the following configuration to location block :
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
For configuration optimizing please see this link :
http://www.if-not-true-then-false.com/2011/nginx-and-php-fpm-configuration-and-optimizing-tips-and-tricks/
A brief short linux how to and problem solving. This blog is intended to be a reference by summarizing from reliable data source and my experience. Readers should have a basic understanding about linux.
แสดงบทความที่มีป้ายกำกับ php แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ php แสดงบทความทั้งหมด
วันอังคารที่ 22 พฤษภาคม พ.ศ. 2555
วันศุกร์ที่ 11 พฤษภาคม พ.ศ. 2555
PHP5.2 for ubuntu
New ubuntu come with PHP5.3. If you need php5.2 to run your old application you have 3 ways.
1) use karmic repository
http://randyfay.com/node/63
2) use .deb
http://thejibe.com/blog/10/10/php-5210-debs-ubuntu-1010-maverick
3) use launchpad respository
https://launchpad.net/~txwikinger/+archive/php5.2
วันศุกร์ที่ 5 มีนาคม พ.ศ. 2553
Advance php error handling
PHP server need different configuration for production and development server.
This article help you understanding php.ini configuration better and applicable to your server.
- display_errors
echo error to the browser this should be turn off for production but should be enable for test server.
- log_errors
instead of displaying error to stderr, you can choose to enable error logging to the file instead for production.
More option can be study here :
http://perishablepress.com/press/2008/01/30/advanced-php-error-handling-via-php/
This article help you understanding php.ini configuration better and applicable to your server.
- display_errors
echo error to the browser this should be turn off for production but should be enable for test server.
- log_errors
instead of displaying error to stderr, you can choose to enable error logging to the file instead for production.
More option can be study here :
http://perishablepress.com/press/2008/01/30/advanced-php-error-handling-via-php/
วันพฤหัสบดีที่ 11 กุมภาพันธ์ พ.ศ. 2553
xcache opcode/optimizer for php tunning
Installing xcache can help php-apache app responding faster.
1) installing xcache
gentoo :
#emerge cache
ubuntu/debian
#apt-get install php5-xcache
after installing you will see path for xcache admin
2) set xcache config and admin password
#echo -n "yourpassword" | md5sum
edit xcache.ini this line :
xcache.admin.pass="" (from previous command)
http://xcache.lighttpd.net/wiki/XcacheIni
3) point apache to xcache admin path
4) browse xcache admin with browser
use this admin page to see what variable need to be adjusted.
I'll point some importtatn config
xcache.size
- set just fit, not too low or too high. see OOM(out of memory column) from admin page. If there are lots of OOM, please consider increasing.
xcache.count
- set to number of your cpu : cat /proc/cpuinfo | grep -c processor
xcache.slots
- the more slot, the faster PHP code accessing
More reading here :
1) installing xcache
gentoo :
#emerge cache
ubuntu/debian
#apt-get install php5-xcache
after installing you will see path for xcache admin
2) set xcache config and admin password
#echo -n "yourpassword" | md5sum
edit xcache.ini this line :
xcache.admin.pass="" (from previous command)
http://xcache.lighttpd.net/wiki/XcacheIni
3) point apache to xcache admin path
4) browse xcache admin with browser
use this admin page to see what variable need to be adjusted.
I'll point some importtatn config
xcache.size
- set just fit, not too low or too high. see OOM(out of memory column) from admin page. If there are lots of OOM, please consider increasing.
xcache.count
- set to number of your cpu : cat /proc/cpuinfo | grep -c processor
xcache.slots
- the more slot, the faster PHP code accessing
More reading here :
- introduction to xcache http://www.ibm.com/developerworks/opensource/library/os-php-fastapps1/
- set xcache adminpage http://www.linuxtuts.net/
ubuntu-webserver-tutorials/ 228-how-install-xcache- administration-page-ubuntu- linux.html - xcaching tunning http://serveradmins.net/tuning-xcache-for-fun-and-profit/
- xcache ini document http://xcache.lighttpd.net/wiki/XcacheIni
สมัครสมาชิก:
บทความ (Atom)