iversonm Posted November 19, 2009 Share Posted November 19, 2009 So i have a crontab scheduled to run every minute, the basic idea is i want it to run a php script that will clear inactive users from a table in a database on my website. so whenever it runs the crontab this is the email i get /var/www/vhosts/website/httpdocs/crontab/clearusers2.php: line 1: ?PHP: No such file or directory /var/www/vhosts/website/httpdocs/crontab/clearusers2.php: line 2: syntax error near unexpected token `'localhost',' /var/www/vhosts/website/httpdocs/crontab/clearusers2.php: line 2: `$Connection2=mysql_connect('localhost', '****', '***') or die(mysql_error());' So I am assuming its not running the php file, any ideas? Comments? Suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/182212-solved-crontab/ Share on other sites More sharing options...
roopurt18 Posted November 19, 2009 Share Posted November 19, 2009 What's the crontab entry look like? And can you paste the first few lines of the PHP file as well? Quote Link to comment https://forums.phpfreaks.com/topic/182212-solved-crontab/#findComment-961514 Share on other sites More sharing options...
trq Posted November 19, 2009 Share Posted November 19, 2009 You need to place a shebang in at the top of your script to tell your shell what interpreter to use to execute the script. eg; #!/usr/bin/php As it stands, your shell itself is trying to execute php code. Quote Link to comment https://forums.phpfreaks.com/topic/182212-solved-crontab/#findComment-961524 Share on other sites More sharing options...
iversonm Posted November 20, 2009 Author Share Posted November 20, 2009 thorpe, you never have failed me. it worked exactly how I wanted to it to. Thankyou topic solved Quote Link to comment https://forums.phpfreaks.com/topic/182212-solved-crontab/#findComment-961605 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.