trigger hippy

Member
Dec 2, 2005
16
0
151
Bristol, UK
I have phpsuexec running, all was fine until I rebuilt apache to upgrade mySQL.

All of a sudden, I do not have permission to write to files using php.
The server is running as the correct user, files have correct permissions (as far as I can see), but still getting permission denied.

See http://www.azimuthprint.co.uk/test.php

I welcome any suggestions!
 
Last edited:

trigger hippy

Member
Dec 2, 2005
16
0
151
Bristol, UK
nope. interestingly, there is nothing there since 19-06-2006 The only entries for 19-06-2006 were info records. no warnings.
There were no entries for yesterday at all.
This (and a couple other points listed below) lead me to believe that there is an issue with the installation of phpsuexec.

The example shows that php is running as the owner, however there are a few other points that seems to imply that it is not.

Session files (in /tmp) are owned by nobody.
e-mails are being sent out as nobody@server

Any suggestions? I am not sure how to check if it is running properly.
 
Last edited:

brianoz

Well-Known Member
Mar 13, 2004
1,146
7
168
Melbourne, Australia
cPanel Access Level
Root Administrator
Sounds like it's not running properly, for some reason.
To find out whether phpsuexec is running, try a phpinfo() and also a passthru("id"), ie

PHP:
<?php
echo phpinfo();
passthru("id");
?>
That will display the userid the PHP script is running under - if it's nobody then you aren't running phpsuexec. The phpinfo() call will displa all sorts of details on what PHP modules are loaded.
 

trigger hippy

Member
Dec 2, 2005
16
0
151
Bristol, UK
I have updated the test.php script shown in the first message to include output from passthru(id);

the result is uid=99(nobody) gid=99(nobody) groups=99(nobody) which indeed indicates that the module is not running properly.

re phpinfo(); - I use it a lot, but I am not sure where I am supposed to be looking to confirm the module is working ok.
Here are some that I thought might be helpful, please let me know if there are other pieces that would help.


Configure Command './configure' '--with-apxs=/usr/local/apache/bin/apxs' '--prefix=/usr/local' '--with-xml' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--with-mysqli' '--with-mysql=/usr' '--enable-discard-path' '--with-pear' '--enable-sockets' '--enable-track-vars' '--with-zlib'

Loaded Modules mod_auth_passthrough, mod_log_bytes, mod_bwlimited, mod_php4, mod_ssl, mod_setenvif, mod_so, mod_expires, mod_auth, mod_access, mod_rewrite, mod_alias, mod_userdir, mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_status, mod_negotiation, mod_mime, mod_log_config, mod_env, http_core

I notice that there is no mod_phpsuexec - I assume there should be?!

Under update apache, (after clicking load previous config) it has the following ticked;

PHP suEXEC Support
suEXEC Module

I also notice that the php version ticked is 4.1, but phpinfo says I am running 4.2!?
What is that about?
 

sparek-3

Well-Known Member
Aug 10, 2002
2,174
281
388
cPanel Access Level
Root Administrator
The PHP Apache module may still be loaded in your httpd.conf file. Try editing the httpd.conf file and looking for two lines (they won't be together) that say:

LoadModule php4_module libexec/libphp4.so
AddModule mod_php4.c


Try commenting those lines out and restarting Apache. You will then want to quickly check a PHP page through the webserver or your phpinfo() page. If you have uncommented these two lines out and phpSuExec does not take over, then your PHP code will be readable through the web. So you want to quickly check to see if this is the case and if its not, edit the httpd.conf file again and remove the comments from those lines to reactivate them and restart Apache.

If you are running phpSuExec then your Server API on the phpinfo page will say CGI instead of Apache. Your Configure command also will not contain a --with-apxs section, and you will not see a list of Apache modules in phpinfo. Since you are seeing all of these, you are most definitely not running phpSuExec, but I do not have a real solution for determining why.
 

trigger hippy

Member
Dec 2, 2005
16
0
151
Bristol, UK
All sorted

I discovered that apache wasn't building properly and the modules weren't loading. This was sorted by updating cPanel.

Why they stopped working, I am not sure, but as it is sorted out now, I am not going to worry!

Thanks