• 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.

    Things to Note when Running PHP as CGI

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

    Installation Tips for Installing Zen Cart when server is running PHP as CGI

    Quick installation tips:
    • upload all the files as-is ... do NOT change any permissions settings (contrary to regular installation instructions)
    • do the regular install (ie: zc_install)
    • now set the configure.php files to 444 permissions (read-only, as per installation instructions) (THIS LIKELY HAS TO BE DONE VIA YOUR HOSTING CONTROL PANEL, not by FTP)
    • most other permissions issues should already be handled just fine

    Tips for Server Administrators running PHP as CGI

    You may have to change some of the parameters for CGI scripts when it's running in that mode or else you will get "500 Internal Server Error" 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 instead of performance benefits.

    Having Problems?

    If you are having problems on a server which runs PHP as CGI, and your hosting account doesn't give you access to configuring the PHP-as-CGI settings, then you' might be better off finding a hosting configuration where PHP is running as an Apache Module instead.

Zen-Cart, Internet Selling Services, Klamath Falls, OR