The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

phpsuExec - permission denied

Discussion in 'General Discussion' started by trigger hippy, Jun 20, 2006.

  1. trigger hippy

    trigger hippy Member

    Joined:
    Dec 2, 2005
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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!
     
    #1 trigger hippy, Jun 20, 2006
    Last edited: Jun 21, 2006
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    Does /usr/local/apache/logs/suexec_log contain any further error details?
     
  3. trigger hippy

    trigger hippy Member

    Joined:
    Dec 2, 2005
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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.
     
    #3 trigger hippy, Jun 21, 2006
    Last edited: Jun 21, 2006
  4. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    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.
     
  5. trigger hippy

    trigger hippy Member

    Joined:
    Dec 2, 2005
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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?
     
  6. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    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.
     
  7. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    sparek-3 is right on - if you are getting uid's of nobody then phpsuexec is definitely not working on your server, as to why, that bears further investigation.
     
  8. trigger hippy

    trigger hippy Member

    Joined:
    Dec 2, 2005
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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
     
Loading...

Share This Page