Troubleshoot - PHP as CGI

From Zen Cart(tm) Wiki
Jump to: navigation, search

Can I run PHP as CGI on my Linux/Unix webserver?

Windows servers always run PHP as a CGI app, so this FAQ may not apply to Windows hosts.


While Zen Cart™ is best run on a server running PHP as an Apache module, some hosts only run PHP as a CGI application. There are generally more restrictions and limitations in functionality if this is how your PHP hosting is setup.


When PHP suExec is enabled the PHP scripts are running as CGI. This limits mostly:

  • the maximum allowed permissions to be 755 - thus when a file has a greater than CHMOD 755, PHP generates an error.
  • the path where a CGI script(s) can be run - any PHP script is limited to 8Mb memory usage (depends on configuration of server).


You may have to change some of the parameters for CGI scripts when it's running in that mode or else you will get Error 500 messages in your browser.


Suggested settings adjustments:

  • Maximum simultaneous processes set to 1024 (when set in the low hundreds may get Error 500's consistently).
  • Process timeout 10 seconds (any longer and the Error 500's cause some real havoc on the server).


There may be slight performance increases running as CGI, but again that depends on configuration, and if you can't configure it correctly, you'll end up with errors and problems instead of performance benefits.


If your hosting account doesn't give you access to configuring the PHP-as-CGI settings, then to run an eCommerce system like Zen Cart™ you'd be better off finding a hosting configuration where PHP is running as an Apache module instead.