Need to keep restarting httpd?

I think its httpd but I am at work and can not remember.

Anyway I have installed Imagemagick and it is running OK but every day or so I need to restart httpd as ImageMagick stops working.
The rest of php etc. is still working OK.

Am I restarting the wrong thing or is there something else I should be looking at or another setting on the server ?

Can’t say I’ve ever came across that before. Presumably you’re invoking imagemagick functions via the imagick php extension rather than executing directly e.g exec(“convert…”); ?
If so, once imagemagick has ceased to respond directly via a php command try doing the same via a php exec, this should narrow it down to whether the imagick extension is crashing. I’d have a look in /var/log/httpd/error_log to see if there’s anything in there to shed light on it.

No I am not using Imagick but running directly with exec( )

I can check the version etc. by entering “which convert” and “convert -version” through Putty and they still come back with the correct path and version.

When I try:


system(" which convert"); 
system(" convert -version");

I get a blank screen.

Thanks for the path to the error file for some reason there is no log for the 8th - so no errors ?
It gets a bit confusing as the server is in america and I need to calculate a time offset.

Looking at the log the server rebooted its self at midnight ( USA time ) and the code pressumably did not run correctly after that as there are errors in the log.

I did a reboot at about 17:00 ( 09:00 USA time )

caught SIGTERM, shutting down
and everything ran OK after that.

I will see what happens tomorrow.

The server is restarting at midnight everynight - no idea why.

I know its not the correct thing to do but in the short term can I setup a cron job to restart httpd everynight at say 00:02 ?

Yep that’s a short term fix worth doing.

var/log/messages might shed some light on overall system issues

There might be an existing cron job either restarting the system or activating a task that is crashing the server (perhaps a backup task of some nature)

The php system commands can have their outputs redirected so you can catch errors:
e.g (if you use exec rather than system)

exec("somecommandstringhere 2>&1", $exec_out, $exec_error); 
//note: the $exec_error returns 1 or 0 depending on error status
// the 2>&1 redirects error text to stdout, so any error message is joined with the normal output 
print_r($exec_out);