Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am testing to see if I am running PHP or suPHP. when I issue phpinfo()

I get back over 600 lines of data. The only mention of suPHP occurs here

<tr><td class="e">Loaded Modules </td><td class="v">core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_reqtimeout mod_setenvif mod_status mod_suphp </td></tr>

I read on another site that Server API should be CGI not Apache in order to be running suPHP

I tried posting the full output but it is over 30,000 characters. If you think it is important, I can try putting half of it.


EDIT It seems I have suPHP partially working. If I load a script and issue getuserid() or get_current_user() it returns my user information, not www-data. However if I try to read/write to a file that doesn't have permission for everyone to read/write, it says failed to open stream: Permission denied. Any ideas what could be causing this?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

I finally figured out what the problem was. I had failed to disable the normal php5 module as described here. All I had to do was issue the commands

a2dismod php5
/etc/init.d/apache2 restart

If anyone else is having similar problems, here are a few sites, in addition to the official page (which is completely useless)

Installation instructions for beginners

Installation help thread on mailing list

Getting started with suPHP

Finally, here are the files you need to change and what changes you should apply

Add the below to your /etc/suphp/suphp.conf file. Note yours might be stored elsewhere, other sites suggested looking in /etc/suphp.conf (note also that there might be some redundancy at the end, I have not had time to fix this yet).

[handlers]
;Handler for php-scripts
application/x-httpd-suphp="php:/usr/bin/php-cgi"
application/x-httpd-php="php:/usr/bin/php-cgi"

;Handler for CGI-scripts
x-suphp-cgi="execute:!self"
x-httpd-suphp="php:/usr/bin/php-cgi"

Finally, add the following to the end of your /etc/apache2/apache2.conf file

suPHP_Engine on
suPHP_AddHandler application/x-httpd-php .php
suPHP_ConfigPath /etc/php5/cgi/
share|improve this answer

That output shows you have both the DSO PHP module enabled as well as the SuPHP module, so which parser is running your scripts depends on your Apache configuration. Specifically, this is defined by the AddHandler directive. You can check your phpinfo() for the defined Server API and if it says CGI then based on the information you've provided, you're defaulting to SuPHP.

share|improve this answer
    
I have the following line in my apache2.conf file suPHP_AddHandler application/x-httpd-php .php –  puk Nov 5 '11 at 5:26
    
What if it does't say CGI but instead Server API is Apache 2.0 Handler. What do I do then. Could you be more specific about what I have to set with AddHandler –  puk Nov 5 '11 at 8:23
    
Apache 2.0 Handler means you're running PHP as a DSO. –  Garrett Nov 13 '11 at 19:02
    
You are correct. If you look below, my mistake was in not disabling the original PHP. –  puk Nov 13 '11 at 22:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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