I created a system for RedHat 8.0 to register new domains and users using shell and expect scripting and tied it all together with PHP for the web management page and to receive info from a W2K server. Everything was working great until I turned safe mode on, which we need.
Anyways, here is the flow. Data is posted to a PHP script. The script then runs a series of checks on that data and then sends the data to several shell scripts for more verification and then ultimately to an expect script to register the new domain if everything is okay.
Due to the fact that the expect script has to reload Apache I have the command break away from the php script itself and run as a background process, so the PHP script doesn't hang up and then fail because Apache reloaded. However in safe_mode the process of the expect script doesn't get sent to the background and ultimately the PHP script fails instead of exiting with a one.
here is the code from the PHP script.
else {
//IF USER AND DOMAIN DON'T EXIST CREATE DOMAIN
$command = "/pathtoscripts/adddomain.exp ".$userid." ".$password." ".$domain." ".$size." > /dev/null 2>&1 &";
exec("$command");
exit("1");
}
here is the settings from /etc/php.ini
; Safe Mode
;
safe_mode = On
safe_mode_gid = On
;don't know if I need to include /dev/null or not, tried with and without but same problem
safe_mode_include_dir = /dev/null/
safe_mode_exec_dir = /pathtoshellandexpectscripts/
😕 Is there anything with my PHP scripting or my PHP settings I could change to get this process into the background and let PHP finish? I would appreciate any and all suggestions.
THANK YOU!