BizLab Posted June 1, 2010 Share Posted June 1, 2010 So i've been kicking around with this cron job for a few days, and i am recieving error after error. I would prefer to run the job without the use of a browser type program, so that i can block access to the php script from the web. I am currently running a simple phpmailer script every 2 minutes for testing purposes, and i am getting a server 500 error. there is nothing in the code that could be failing, so i was looking for some input. USING - Apache 2.0 handler - CentOS - Plesk 8x - VPS server My current command is: 2 * * * * wget https://www.domain.com/admin/office/cron-jobs/test-2.php I have also tried: 2 * * * * curl https://www.domain.com/admin/office/cron-jobs/test-2.php And even: 2 * * * * /var/bin/php /var/www/vhosts/domain.com/httpdocs/admin/office/cron-jobs/test-2.php The last was an attempt to avoid the browser systems all together. The result of the cURL was the most profitable showing (cron log email): ----------------------------------------------------------------- % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 337 100 337 0 0 1040 0 --:--:-- --:--:-- --:--:-- 1040 100 337 100 337 0 0 1040 0 --:--:-- --:--:-- --:--:-- 0 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="https://www.domain.com/admin/office/cron-jobs/test-2.php <address>Apache/2.2.3 (CentOS) Server at www.domain.com Port 80</address> </body></html> ------------------------------------------------------------------ the wget resulted in this error ------------------------------------------------------------------------- --10:10:01-- https://www.domain.com/admin/office/cron-jobs/ad-expired-notice.php Resolving www.domain.com... Connecting to www.domain.com|ipaddress|:443... connected. HTTP request sent, awaiting response... 500 Internal Server Error 10:10:01 ERROR 500: Internal Server Error. ------------------------------------------------------------------------ And when tested in the browser manually, all the test scripts work 100% The test Script <?php require('/phpmailer/class.phpmailer.php'); $msg = '<p>TEST EMAIL # 2 FROM CRON JOBS</p>'; $mail = new PHPMailer; $mail->ClearAddresses(); $mail->AddAddress('email@domain.com', 'Dude'); $mail->From = 'email@domain.com'; $mail->FromName = 'Dudes email@domain.com'; $mail->Subject = '# 2 YOUR TEST!'; $mail->Body = $msg; $mail->isHTML = true; $mail->AltBody = text; $mail->Send(); ?> Any ideas guys?? Quote Link to comment https://forums.phpfreaks.com/topic/203521-cron-jobs-using-plesk-8x-tried-wget-curl-no-results-and-500-error/ Share on other sites More sharing options...
trq Posted June 2, 2010 Share Posted June 2, 2010 PHP would never be installed into /var/bin, in fact that directory should not exist. try /usr/bin/php Quote Link to comment https://forums.phpfreaks.com/topic/203521-cron-jobs-using-plesk-8x-tried-wget-curl-no-results-and-500-error/#findComment-1066443 Share on other sites More sharing options...
BizLab Posted June 3, 2010 Author Share Posted June 3, 2010 Good call Thorpe, i must have been dilerous while tuping that command!! only one more problem: the cron job only ran once... it is set for every 2 minutes and was activated for about 35 minutes - any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/203521-cron-jobs-using-plesk-8x-tried-wget-curl-no-results-and-500-error/#findComment-1067415 Share on other sites More sharing options...
trq Posted June 3, 2010 Share Posted June 3, 2010 Your job is set to execute on the 2nd minute of every hour. You want: */2 * * * * Quote Link to comment https://forums.phpfreaks.com/topic/203521-cron-jobs-using-plesk-8x-tried-wget-curl-no-results-and-500-error/#findComment-1067420 Share on other sites More sharing options...
BizLab Posted June 4, 2010 Author Share Posted June 4, 2010 Thanks thorpe!! I just figured it out 5 minutes ago!! lol - i appreciate the help though Everything seems to be running perfectly! I will try to block access to these scripts using .htaccess deny from all - - or do you think i would be better served to use another method?? I have seen a $_SERVER[''] method somewhere, but i can't recall the exact syntax for this. The .htaccess method would stop the script from even attempting to run or performing any evaluations, so i figured it may be more efficient. Quote Link to comment https://forums.phpfreaks.com/topic/203521-cron-jobs-using-plesk-8x-tried-wget-curl-no-results-and-500-error/#findComment-1067479 Share on other sites More sharing options...
trq Posted June 4, 2010 Share Posted June 4, 2010 Move the script outside of your servers document root. That way no one can actually browse to them. Quote Link to comment https://forums.phpfreaks.com/topic/203521-cron-jobs-using-plesk-8x-tried-wget-curl-no-results-and-500-error/#findComment-1067480 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.