1

I'm trying to set up a web app (which I didn't make) on a server which uses an .htaccess file written like this:

<Files *.php>
   SetHandler su-cgi-script
   SetEnv INTERPRETER_PATH /usr/bin/php-cgi
</Files>

I've installed LAMPP with all the necessary libraries, but I forgot the php5-cgi package and now I'm trying to set it up.

I've installed it and enabled it with a2enmod cgi. But it still doesn't work and I'm wondering if I need to somehow change the php configuration file loaded. The one displayed on the phpinfo(); page shows that the one loaded is /etc/php5/apache2/php.ini I thought it might work if I could change it to /etc/php5/cgi/php.ini. Though I'm not familiar with this. Everything currently works fine if I get rid of the directives declared in the .htaccess file, but this is not a solution, just a proof that everything else works.

3
  • Have you tried stopping and re-starting your web server? This is necessary to make the configuration files reload. One exception would be any .htaccess file for a site.
    – closetnoc
    Commented Jan 14, 2015 at 16:12
  • Yes I've reloaded and restarted.
    – Klik
    Commented Jan 14, 2015 at 16:55
  • Unfortunately, I do not know enough to answer your question. I just wanted to make sure that you knew to stop and start the web server. I wish I knew more so that I could help you.
    – closetnoc
    Commented Jan 14, 2015 at 16:57

1 Answer 1

1

Just remove that crap from .htaccess. These lines are meant to be used in a completely different setup than yours.

Obviously, you have Apache's mod_php5 already installed, and it is used for your PHP files automatically. That's perfectly fine! No need for mod_cgi.

However, if you really don't want to use mod_php, you should uninstall libapache2-mod-php5 before further debugging. That way it can't confuse you. (Also, this is the reason a different php.ini is used.)

Finally, you should describe the exact behaviour instead of merely saying "it doesn't work". Does it show an Apache error? If so, which one? Or, does it show the PHP source code instead of executing it? What's happening, exactly?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.