Getting PHP to work with Cherokee

Discussion in 'Installation/Configuration' started by maineac, Oct 31, 2010.

  1. maineac

    maineac New Member

    Let me first thank falko for the nice Howto on getting this set up. However, it would be nice, when you get to the part where you check your php using info.php if you would give some hints for where to look if it doesn't work.

    I am installing this on Ubuntu 10.4 using PHP5 and Cherokee v1.08 which is a little newer than the version on the Howto. There was a little difference in the way you enable PHP on Cherokee. Under the default virtual server behaviors you need to select "Rule Managment" instead of Wizards. Then you can add a rule, look for languages and pick PHP. It's pretty straight forward from there.

    But it still doesn't work. When I type in the url "http://localhost/info.php" I get an "Unable to Connect" message. If I try the same url without the "/info.php" I get the classic Cherokee Test Page.

    If I try "php info.php" from a terminal on the web root I get the information printed out on the terminal.

    Incidentally, "info.php" looks like this:
    Just as a note, I did install the FastCGI php5-cgi as you recommended.

    I am using FireFox 3.6.12 for a browser.

    Does anyone have any idea where I can look to find out why this doesn't work?
  2. falko

    falko Super Moderator ISPConfig Developer

    I've just written the tutorial for Ubuntu 10.10 (will be published soon), and there I had to do
    killall php-cgi
    and then restart Cherokee.
  3. maineac

    maineac New Member


    I've gone a little beyond that now. But I ran "Killall cgi-php" as root and found no cgi-php process running.

    One thing that wasn't clear on the Ubuntu 10.4 Howto or the Cherokee documents is how to set the URL you want to use for your virtual server. I've figured this out with the help of some folks on //freenode.irc#cherokee.

    If you set the Nickname of the server to "" and Host Match method to "Match Nickname" the URL will be "". Note that any string you use will work PROVIDED the string maps to an IP address, either in your DNS or your hosts file.

    I have verified that php works on a command line

    I have verified that Firefox will find an html file on my URL through the Cherokee server by adding an index.html and setting the Directory Indexes to "index.php,index.html".

    Now if I use the URL without a file I get the 404 URL not found error. (i.e. http://myserver.test)

    If I add the index.html (http://myserver.test/index.html) I get the static webpage, index.html.

    My Settings are:

    Under the Rulesets, the Extensions PHP rule handler is FastCGI, the Document Root is "/usr/lib/cgi-bin" (which does contain a link named 'php' to php5). The "Information Services" is set to Nick:"PHP Interpreter", Host:

    Any ideas on why it doesn't work?
  4. maineac

    maineac New Member

    I've found the solution

    I removed "/usr/lib/cgi-bin" from the Document Root. It is now blank, and the server will serve my php page!

    I didn't see that mentioned in the Howto, but perhaps it is something that was supposed to be properly set by the wizard. With the version of Cherokee I am using (1.0.8) there was not wizard for setting the Behavior rules.

Share This Page