2010-10-04, 07:16 PM
I want a PHP script to restart a service eg. Apache and to reboot the system.
I've tried several solutions, but they have all failed. Solutions tried:
Creating a bash file with the command in it, chmod 4755, chown root, then running the PHP exec('/path/to/file.sh') command. That didn't work, so i tried using system() instead. That also failed.
Secondly i tried using a cronjob that runs a bash file that checks for a certian file every minute. Then the PHP script creates that file. When the bash script finds the file it restarts the service. But that also doesn't work. - For some reason, php won't open the file to create it...
Anyone know any other solutions?
I've tried several solutions, but they have all failed. Solutions tried:
Creating a bash file with the command in it, chmod 4755, chown root, then running the PHP exec('/path/to/file.sh') command. That didn't work, so i tried using system() instead. That also failed.
Secondly i tried using a cronjob that runs a bash file that checks for a certian file every minute. Then the PHP script creates that file. When the bash script finds the file it restarts the service. But that also doesn't work. - For some reason, php won't open the file to create it...
Anyone know any other solutions?