Title says it all; I cannot run shell commands properly from PHP (CGI).
Most commands (pwd and my own program) end with an exit code of 1 (permission denied).
The command ls ends with an exit code of 2.
System Note:
- Apache is running as apache:apache (user/group)
- PHP is not chrooted (AFAIK) if you know a definitive way to find out, please reply
- PHP is not in SAFE_MODE
- selinux is DISABLED (sestatus says so)
- suexec is enabled (not sure what to do with it though)
- Functions are not disabled from PHP (otherwise I'd get scripting errors instead of exit codes)
Things I tried:
- Disabled selinux (it was enabled)
- Made apache to run as root (it crashed - a well known issue)
- Changed file permissions of my entire DOCROOT to 0755 and 0777 (and back)
- Changed file owner of my entire DOCROOT to root and nobody, both caused apache to show "access denied" errors
- To use
straceto get a clue of what's going on, but it failed as well - Run PHP code through CLI (
php -r "echo exec('pwd');") - and it works - Ensure error logging is at it's max (and displayed), both for PHP and Apache (E_ALL / Debug) - no errors showed up
More notes
Dump of $_SERVER
[HTTP_HOST] => localhost
[HTTP_USER_AGENT] => Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110622 CentOS/3.6-1.el5.centos Firefox/3.6.18
[HTTP_ACCEPT] => yaddayaddayaddayaddayadda
[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip,deflate
[HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
[HTTP_KEEP_ALIVE] => 115
[HTTP_CONNECTION] => keep-alive
[HTTP_REFERER] => http://localhost/K2F/?test=system-check
[HTTP_CACHE_CONTROL] => max-age=0
[PATH] => /sbin:/usr/sbin:/bin:/usr/bin
[SERVER_SIGNATURE] => <address>Apache/2.2.3 (CentOS) Server at localhost Port 80</address>
[SERVER_SOFTWARE] => Apache/2.2.3 (CentOS)
[SERVER_NAME] => localhost
[SERVER_ADDR] => 127.0.0.1
[SERVER_PORT] => 80
[REMOTE_ADDR] => 127.0.0.1
[DOCUMENT_ROOT] => /var/www/html
[SERVER_ADMIN] => root@localhost
[SCRIPT_FILENAME] => /var/www/html/K2F/index.php
[REMOTE_PORT] => 49341
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] => test=wkhtmltox
[REQUEST_URI] => /K2F/?test=wkhtmltox
[SCRIPT_NAME] => /K2F/index.php
[PHP_SELF] => /K2F/index.php
[REQUEST_TIME] => 1315908875
Misc. PHP functions
[GID] => 48 ---------------.___ both are correct
[UID] => 48 ---------------'
[PID] => 4152
[USR] => apache -----------.___ fine as well
[CWD] => /var/www/html/K2F --'
echo exec('pwd');(should show/root). No, there's nothing related in the error log (both PHP's and Apache's). – Christian Sep 13 '11 at 10:271or a2. What do you mean by "logging configuration section"? As to reinstall, it's the only sane option that works with linux when all else fails... – Christian Sep 13 '11 at 11:14