suPHP and 500 Internal Server Errors

petteyg359

Member
May 15, 2008
20
0
51
I have used easyapache to compile latest apache 2.2 with php 5.2.6 and suphp. With PHP5 set to DSO in WHM, everything works fine. If I set it to suPHP, everything stops working.
index.php
Code:
<?php phpinfo(); ?>
in public_html returns a 500 error. public_html is 755, index.php is 644, and both are owned by my user:group. /usr/local/apache/logs/suphp_log contains only [info] lines, saying 'executing
"/home/myuser/public_html/index.php" as UID 32007, GID 32009'. The UID and GID are correct for my user.
Setting PHP5 back to DSO in WHM returns everything to working condition.
The only suggestions for "fixes" I've found all assume that file/directory permissions are incorrect, which I've already checked. What else could cause the errors?
 
Last edited:

petteyg359

Member
May 15, 2008
20
0
51
Just noticed in /usr/local/apache/logs/error_log, when I turn on suPHP, I get the following on any attempt to execute a php page:
Code:
[Thu Aug 14 22:02:23 2008] [notice] caught SIGTERM, shutting down
[Thu Aug 14 22:02:25 2008] [notice] suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec)
[Thu Aug 14 22:02:25 2008] [notice] Digest: generating secret for digest authentication ...
[Thu Aug 14 22:02:25 2008] [notice] Digest: done
[Thu Aug 14 22:02:26 2008] [notice] mod_bw : Memory Allocated 0 bytes (each conf takes 32 bytes)
[Thu Aug 14 22:02:26 2008] [notice] mod_bw : Version 0.8 - Initialized [0 Confs]
[Thu Aug 14 22:02:26 2008] [notice] Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8b DAV/2 mod_bwlimited/1.4 configured -- resuming normal operations
[Thu Aug 14 22:02:33 2008] [error] [client 70.248.122.48] /usr/bin/php: error while loading shared libraries: libaudit.so.0: failed to map segment from shared object: Cannot allocate memory
[Thu Aug 14 22:02:33 2008] [error] [client 70.248.122.48] Premature end of script headers: phpinfo.php
[Thu Aug 14 22:02:33 2008] [error] [client 70.248.122.48] File does not exist: /home/username/public_html/500.shtml
That line with libaudit.so.0 looks like it might be my problem. Any idea where that's coming from, and anything I can set in EA3 to rebuild and fix it?
 

petteyg359

Member
May 15, 2008
20
0
51
This is on a VPS account with TekTonic. There is >768MB free (1.25GB total) RAM. On my previous EA3 build, the only thing obviously memory related enabled is mm.
 

petteyg359

Member
May 15, 2008
20
0
51
Rebuilt apache, this time with mm option disabled. Now I get

[Sat Aug 16 01:11:11 2008] [error] [client 70.248.122.48] /usr/bin/php: error while loading shared libraries: libXau.so.6: failed to map segment from shared object: Cannot allocate memory
[Sat Aug 16 01:11:11 2008] [error] [client 70.248.122.48] Premature end of script headers: index.php

in /usr/local/apache/logs/error_log when attempting to load a page. This is happening on any PHP page, contents don't matter. I haven't attempted rebuilding with PHP 5.2.5 or earlier, yet (currently 5.2.6). Will attempt that next.

EDIT: PHP 5.2.5 doesn't fix it, same error as above. Will try moving down to Apache 2.0 next (2.2 currently).
 
Last edited:

hightekhosting

Active Member
Aug 12, 2007
27
0
51
Ok, I've seen your issues before so I suggest you perform the following in SSH:

Code:
# /scripts/postsuexecinstall
# /scripts/chownpublichtmls
# cd /home 
# find -perm 777 -exec chmod 755 {} \; -print
# find -perm 666 -exec chmod 644 {} \; -print
# /scripts/fixsuexeccgiscripts
Perform each command one by one and see how that goes. It should reconfigure the home directories of the users as well as set any folder permissions to 755 and file permissions to 644.

Everything should work after that :)

Hope it helps.

Regards,

Dale Evans
Manager
 

screege

Well-Known Member
Aug 11, 2004
190
1
166
Did you manage to resolve your issue?I just installed suPHP and every site even the ones installed with fantastico gives me a 500 error, any help will be appreciated.
 

screege

Well-Known Member
Aug 11, 2004
190
1
166
Well I managed to resolve almost every script with the suggestions given above and deleting any php_value on the .htacess files seems to work except I am having trouble with one particular script wich will not allow me to run without the php flag. I do not know how to put this to work with suPHP:

php_value "magic_quotes_gpc" "1"
php_value "register_globals" "1"
php_value "error_reporting" "2039"

If anyone can help me I would appreciate it a lot.
 

petteyg359

Member
May 15, 2008
20
0
51
php_value "magic_quotes_gpc" "1"
php_value "register_globals" "1"
php_value "error_reporting" "2039"

If anyone can help me I would appreciate it a lot.
Since I can't get suPHP to work for me, I can't give you the answer you're looking for, but I can say that any script that needs register_globals should be replaced.
 

petteyg359

Member
May 15, 2008
20
0
51
Just started again on a clean new install of cPanel. Used easyapache with Apache 2.0, PHP 5.2.5, this config:

Code:
---
Apache:
  optmods:
    Access: 1
    Actions: 1
    Alias: 1
    Asis: 0
    AuthAnon: 0
    AuthDB: 0
    AuthDBM: 0
    AuthDigest: 0
    AuthLDAP: 0
    AuthnAlias: 0
    AuthnAnon: 0
    AuthnDBD: 0
    AuthnDBM: 0
    AuthnDefault: 1
    AuthnzLDAP: 0
    AuthzDBM: 0
    AuthzHost: 1
    AuthzOwner: 0
    Autoindex: 1
    Bucketeer: 0
    Cache: 0
    CaseFilter: 0
    CaseFilterIn: 0
    CernMeta: 0
    CharsetLite: 0
    DAVFs: 0
    DAVLock: 0
    DBD: 0
    DIR: 1
    Dav: 0
    Deflate: 1
    DiskCache: 0
    Distcache: 0
    Dumpio: 0
    Echo: 0
    Env: 0
    Expires: 1
    ExtFilter: 0
    Fastcgi: 1
    FileCache: 0
    Fileprotect: 1
    Frontpage: 0
    Headers: 1
    Ident: 0
    Imagemap: 0
    LDAP: 0
    LogAgent: 0
    LogConfig: 1
    LogForensic: 0
    LogReferer: 0
    MPMEvent: 0
    MPMLeader: 0
    MPMPerchild: 0
    MPMPrefork: 1
    MPMThreadpool: 0
    MPMWorker: 0
    MemCache: 0
    Mime: 1
    MimeMagic: 0
    MmapStatic: 0
    Negotiation: 1
    OptionalFnExport: 0
    OptionalFnImport: 0
    OptionalHookExport: 0
    OptionalHookImport: 0
    PHPAsUser: 1
    Proxy: 1
    RaiseFDSetsize: 0
    RaiseHardServerLimit: 0
    Rewrite: 0
    Setenvif: 1
    Speling: 0
    Status: 1
    UniqueId: 0
    Userdir: 1
    Usertrack: 0
    Version: 0
    VhostAlias: 0
  version: 2
Cpanel::Easy::EAccelerator: 0
Cpanel::Easy::IonCubeLoader: 0
Cpanel::Easy::ModBandwidth: 1
Cpanel::Easy::ModGzip: 0
Cpanel::Easy::ModJk5: 0
Cpanel::Easy::ModMono: 0
Cpanel::Easy::ModPerl: 0
Cpanel::Easy::ModSec: 0
Cpanel::Easy::PHP4: 0
Cpanel::Easy::PHP4::4_4: 0
Cpanel::Easy::PHP4::4_5: 0
Cpanel::Easy::PHP4::4_6: 0
Cpanel::Easy::PHP4::4_7: 0
Cpanel::Easy::PHP4::4_8: 0
Cpanel::Easy::PHP4::4_9: 0
Cpanel::Easy::PHP4::Bcmath: 0
Cpanel::Easy::PHP4::Bz2: 0
Cpanel::Easy::PHP4::CGI: 0
Cpanel::Easy::PHP4::Calendar: 0
Cpanel::Easy::PHP4::Concurrent: 0
Cpanel::Easy::PHP4::Curl: 0
Cpanel::Easy::PHP4::CurlSSL: 0
Cpanel::Easy::PHP4::DBX: 0
Cpanel::Easy::PHP4::Dbase: 0
Cpanel::Easy::PHP4::DiscardPath: 0
Cpanel::Easy::PHP4::DomXslt: 0
Cpanel::Easy::PHP4::Exif: 0
Cpanel::Easy::PHP4::FTP: 0
Cpanel::Easy::PHP4::Fastcgi: 0
Cpanel::Easy::PHP4::ForceCGIRedirect: 0
Cpanel::Easy::PHP4::GD: 0
Cpanel::Easy::PHP4::Gettext: 0
Cpanel::Easy::PHP4::HardPHP: 0
Cpanel::Easy::PHP4::Iconv: 0
Cpanel::Easy::PHP4::Imap: 0
Cpanel::Easy::PHP4::Java: 0
Cpanel::Easy::PHP4::MM: 0
Cpanel::Easy::PHP4::MagicQuotes: 0
Cpanel::Easy::PHP4::MailHeaders: 0
Cpanel::Easy::PHP4::Mbregex: 1
Cpanel::Easy::PHP4::Mbstring: 0
Cpanel::Easy::PHP4::Mcrypt: 0
Cpanel::Easy::PHP4::MemoryLimit: 0
Cpanel::Easy::PHP4::Mhash: 0
Cpanel::Easy::PHP4::MimeMagic: 0
Cpanel::Easy::PHP4::Ming: 0
Cpanel::Easy::PHP4::MysqlOfSystem: 0
Cpanel::Easy::PHP4::Openssl: 0
Cpanel::Easy::PHP4::PDFLib: 0
Cpanel::Easy::PHP4::POSIX: 1
Cpanel::Easy::PHP4::PathInfoCheck: 1
Cpanel::Easy::PHP4::PcreRegex: 1
Cpanel::Easy::PHP4::Pear: 1
Cpanel::Easy::PHP4::Pgsql: 0
Cpanel::Easy::PHP4::Pspell: 0
Cpanel::Easy::PHP4::SNMP: 0
Cpanel::Easy::PHP4::SafeMode: 0
Cpanel::Easy::PHP4::SafePHPCGI: 0
Cpanel::Easy::PHP4::Sockets: 0
Cpanel::Easy::PHP4::Swf: 0
Cpanel::Easy::PHP4::TTF: 0
Cpanel::Easy::PHP4::Versioning: 0
Cpanel::Easy::PHP4::Wddx: 0
Cpanel::Easy::PHP4::XmlRPC: 0
Cpanel::Easy::PHP4::XsltSablot: 0
Cpanel::Easy::PHP4::ZendMultibyte: 0
Cpanel::Easy::PHP4::Zip: 0
Cpanel::Easy::PHP4::Zlib: 0
Cpanel::Easy::PHP5: 1
Cpanel::Easy::PHP5::2_3: 0
Cpanel::Easy::PHP5::2_4: 0
Cpanel::Easy::PHP5::2_5: 1
Cpanel::Easy::PHP5::2_6: 0
Cpanel::Easy::PHP5::Bcmath: 1
Cpanel::Easy::PHP5::Bz2: 1
Cpanel::Easy::PHP5::CGI: 0
Cpanel::Easy::PHP5::Calendar: 1
Cpanel::Easy::PHP5::Concurrent: 0
Cpanel::Easy::PHP5::Curl: 1
Cpanel::Easy::PHP5::CurlSSL: 1
Cpanel::Easy::PHP5::Curlwrappers: 1
Cpanel::Easy::PHP5::DBX: 0
Cpanel::Easy::PHP5::Dbase: 0
Cpanel::Easy::PHP5::DiscardPath: 0
Cpanel::Easy::PHP5::Exif: 1
Cpanel::Easy::PHP5::FTP: 1
Cpanel::Easy::PHP5::Fastcgi: 0
Cpanel::Easy::PHP5::ForceCGIRedirect: 0
Cpanel::Easy::PHP5::GD: 1
Cpanel::Easy::PHP5::Gettext: 1
Cpanel::Easy::PHP5::HardPHP: 0
Cpanel::Easy::PHP5::Iconv: 0
Cpanel::Easy::PHP5::Imap: 1
Cpanel::Easy::PHP5::Java: 0
Cpanel::Easy::PHP5::MM: 1
Cpanel::Easy::PHP5::MagicQuotes: 1
Cpanel::Easy::PHP5::MailHeaders: 0
Cpanel::Easy::PHP5::Mbregex: 0
Cpanel::Easy::PHP5::Mbstring: 1
Cpanel::Easy::PHP5::Mcrypt: 1
Cpanel::Easy::PHP5::MemoryLimit: 0
Cpanel::Easy::PHP5::Mhash: 1
Cpanel::Easy::PHP5::MimeMagic: 0
Cpanel::Easy::PHP5::Ming: 0
Cpanel::Easy::PHP5::Mysql: 1
Cpanel::Easy::PHP5::MysqlOfSystem: 1
Cpanel::Easy::PHP5::Mysqli: 1
Cpanel::Easy::PHP5::Openssl: 1
Cpanel::Easy::PHP5::PDFLib: 0
Cpanel::Easy::PHP5::PDO: 0
Cpanel::Easy::PHP5::PDOMySQL: 0
Cpanel::Easy::PHP5::POSIX: 0
Cpanel::Easy::PHP5::PathInfoCheck: 0
Cpanel::Easy::PHP5::Pear: 0
Cpanel::Easy::PHP5::Pgsql: 0
Cpanel::Easy::PHP5::Pspell: 0
Cpanel::Easy::PHP5::SNMP: 0
Cpanel::Easy::PHP5::SOAP: 0
Cpanel::Easy::PHP5::SafeMode: 0
Cpanel::Easy::PHP5::SafePHPCGI: 0
Cpanel::Easy::PHP5::Sockets: 1
Cpanel::Easy::PHP5::Swf: 0
Cpanel::Easy::PHP5::TTF: 1
Cpanel::Easy::PHP5::Tidy: 1
Cpanel::Easy::PHP5::Versioning: 0
Cpanel::Easy::PHP5::Wddx: 0
Cpanel::Easy::PHP5::WithoutIconv: 0
Cpanel::Easy::PHP5::XSL: 0
Cpanel::Easy::PHP5::XmlRPC: 0
Cpanel::Easy::PHP5::XsltSablot: 0
Cpanel::Easy::PHP5::ZendMultibyte: 0
Cpanel::Easy::PHP5::Zip: 0
Cpanel::Easy::PHP5::Zlib: 1
Cpanel::Easy::PHP5::cPPHPOpts: 0
Cpanel::Easy::PHPSuHosin: 1
Cpanel::Easy::SourceGuardian: 0
Cpanel::Easy::Zendopt: 0
_meta:
  implies:
    changed:
      Cpanel::Easy::PHP4::CGI:
        changed_by: Cpanel::Easy::Apache::PHPAsUser
        changed_to: 0
    circles: {}

  name: suPHP Test 1
  note: Config attempting to achieve working suPHP. Apache 2.0, PHP 5.2.5, etc. 10/14/2008 20:35 CST.
  revision: _4qY7xLMwuPpiVabzCsTf_JOs1GBwUbsvKdRPtQtsG0TmTvxYzWEMhOAxQIeEVZq
Amazingly enough, things seem to be working so far, but all I've tested is a simple echo 'hello world'; and phpinfo();. Appears the incompatibility is Apache 2.2... While searching Google on this issue and reading various tips and such, several places say that cPanel, rather than using suPHP 0.6.2, uses 0.6.1 with a cPanel-supplied patch that is supposed to be equivalent to 0.6.2. Considering that 0.6.2 is the version of suPHP that adds Apache 2.2 support... 0.6.3 has been out since March, so I really hope cPanel isn't still using 0.6.1 (or their 0.6.2 equivalent). Anybody have a working Apache 2.2 cPanel host with suPHP working?
 
Last edited:

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
EasyApache build 4020 updated SuPHP support to 0.6.3. Please update your cPanel installation to receive the latest EasyApache. Also note you will need to recompile PHP via EasyApache to use the latest SuPHP.
 

petteyg359

Member
May 15, 2008
20
0
51
On the date of my original post on 8/14/2008, the current EasyApache build was 4415. I have always kept cPanel set to automatic RELEASE updates, so I very much doubt I was ever using a build of EasyApace less than 4020. I can attempt more configs to try and isolate the problem, but as I've finally managed a working config, I'd rather start putting my site together now.
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
On the date of my original post on 8/14/2008, the current EasyApache build was 4415. I have always kept cPanel set to automatic RELEASE updates, so I very much doubt I was ever using a build of EasyApace less than 4020. I can attempt more configs to try and isolate the problem, but as I've finally managed a working config, I'd rather start putting my site together now.
You're always welcome to let our technical analysts assist you with EasyApache issues as well as any other cPanel/WHM issues.
 

Website Rob

Well-Known Member
Mar 23, 2002
1,501
1
318
Alberta, Canada
cPanel Access Level
Root Administrator
Here is another 'gotcha' to watch for when switching over to using suPHP.

Any .htaccess file previously using any PHP directives must have the PHP directives removed. All PHP directives must be ported over to a 'php.ini' for the account in question. The 'php.ini' is placed in Document Root, same as the .htaccess file. You'll probably have to make a 'php.ini' file as there was no need previously to have one.