How can I debug exec() problems?

have a look at /etc/php.ini , there under:

; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.disable-functions
disable_functions =

make sure that exec is not listed like this:

disable_functions=exec

If so, remove it and restart the apache.

For easy debugging I usually like to execute the php file manually (Can request more errors without setting it in the main ini). to do so add the header:

#!/usr/bin/php
ini_set("display_errors", 1);
ini_set("track_errors", 1);
ini_set("html_errors", 1);
error_reporting(E_ALL);

to the beginning of the file, give it permissions using chmod +x myscript.php and execute it ./myscript.php. It’s very heedful especially on a busy server that write a lot to the log file.

EDIT

Sounds like a permissions issue. Create a bash script that does something simple as echo "helo world" and try to run it. Make sure you have permissions for the file and for the folder containing the file. you chould just do chmod 755 just for testing.

Leave a Comment