Project

General

Profile

Howto PHP » History » Revision 2

Revision 1 (stbuehler, 2009-11-12 22:46) → Revision 2/7 (stbuehler, 2009-11-12 22:46)

h1. Howto PHP 

 h2. Lighttpd config 

 <pre> 
 setup { 
	 module.load ( "mod_fastcgi" ); 
 } 

 php { 
	 if phys.path =$ ".php" { 
		 if physical.is_file { 
			 fastcgi "unix:/var/run/lighttpd/sockets/www-default-php.sock"; 
		 } 
	 } 
 } 

 # ... some vhost/directory/whatever 
 # just use it in places where you want allow php. 
 # you need docroot before it (an alias / index if you need them)! 

 docroot "/var/www"; 
 alias "/phpmyadmin" => "/usr/share/phpmyadmin"; 
 index ( "index.php", "index.html" ); 

 # if you want to use urls like http://example.com/index.php/some/path (using your php files like directories), you need this: 
 pathinfo; 

 php; 

 # ... 
 </pre> 

 h2. Spawning php 

 Simple ./run script to spawn rails applications with [[spawn-fcgi:WikiStart|spawn-fcgi]] [[spawn-fcgi:WikiStart|spawn-fcgi] and runit/daemontools: 
 <pre> 
 #!/bin/sh 

 exec 2>&1 

 PHP_FCGI_CHILDREN=2 \ 
 PHP_FCGI_MAX_REQUESTS=10000 \ 
 LANG=C LC_ALL=C \ 
 exec /usr/bin/spawn-fcgi -n -s /var/run/lighttpd/sockets/www-default-php.sock -u www-default -U www-data -- /usr/bin/php5-cgi 
 </pre>