php5_cli php5_cgi which better?

There is no "better" one but there is probably one that fits better your needs.
There are a few important differences, mainly because php5_cli is in reality mod_php, a module for the Apache httpd binary (therefore it is faster but limited in security, scalability and customization), while php5_cgi is the "real" PHP interpreter run separately, by Apache or a module of Apache like mod_fastcgi (therefore it is slightly slower but much, much better for a shared or large system).

Migration from mod_php to PHP-CGI (never encountered anyone doing the inverse) is well described in a topic within this very forum. Use the search function if you need it.

Sometimes I ask myself why they insist on developing mod_php or why is it proposed as default solution in many distributions, since the advantages are very few, the disadvantages are (from my professional point of view) huge and the speed doesn't really change that much... but that's my personal opinion.
 
Last edited:
how can i change php5_cli to php5_cgi.
i edit options.conf,and bulid,but there is an 500 error.
 
The main advantage of php_cgi is that it runs every php script as it's owner, and creates and modfies files as it's owner.

This makes site management easier, makes it easier to determine which user, if any, is sending spam through your server, and makes it much harder for attackers gain a foothold on your server, as the user running a script is limited to being able to only work as that user on files owned by that user, instead of all files managed by apache.

Jeff
 
This makes site management easier, makes it easier to determine which user, if any, is sending spam through your server, and makes it much harder for attackers gain a foothold on your server, as the user running a script is limited to being able to only work as that user on files owned by that user, instead of all files managed by apache.

Yes, this is my favorite feature of suPHP, because when running shared servers you're bound to get listed in RBLs at some point, so the quicker you can identify and remove spammers, the better.

Rick
 
The main advantage of php_cgi is that it runs every php script as it's owner, and creates and modfies files as it's owner.

This makes site management easier, makes it easier to determine which user, if any, is sending spam through your server, and makes it much harder for attackers gain a foothold on your server, as the user running a script is limited to being able to only work as that user on files owned by that user, instead of all files managed by apache.

Jeff

Kinda late into the topic,. but why do we have DA set cli as the default?
What about memory usage, is mod_php lighter or heavier (is there a diff between them in terms of memory)?

How would safe_mod and open_basedir behave? do they still get in use using the CGI option?
 
why do we have DA set cli as the default?
What about memory usage, is mod_php lighter or heavier (is there a diff between them in terms of memory)?
cli (using mod_php) is a lot lighter on system resources. On today's higher power systems it's not as important, and using mod_php (built into apache) apache doesn't need the time or memory overhead to start up another instance of php each time it comes across a php script.

It's controversial as to how important that is; there are people arguing both sides of the fence. DirectAdmin gives you choice :).

Jeff
 
Great thread everyone.... keep the info coming... I know there are many people out there wondering the same.
 
Back
Top