JewelsPiper Posted September 29, 2014 Share Posted September 29, 2014 I have purchased a ad manager type script and have put so much work in to the site but i cannot get the cron file to execute properly due to errors. The makers of the script arent answering my emails so I am left to find the answer myself im hoping some experts can shine a light on this for me I have the cron running once daily as required the error messages are as follows: /home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 1: ?php: No such file or directory/home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 2: syntax error near unexpected token `;'/home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 2: `ob_start();' I have installed the script on two different hosts and get the exact same errors. any help would be much appriciated the contents of the cron file are below ______________________________________________ <?php ob_start(); ini_set("max_execution_time", 0); error_reporting(0); require_once("db_connection.php"); // hits table fix $ws = mysql_query("select pid from publishersinfo"); while($row = mysql_fetch_assoc($ws)){ $max = mysql_fetch_assoc(mysql_query("SELECT count(distinct ip) as distinct_hits, count(ip) as hits, date from hits where pub_id='$row[pid]' group by date order by hits desc, distinct_hits desc limit 1")); mysql_query("update publishersinfo set hits = '$max[hits]', distinct_hits = '$max[distinct_hits]' where pid = '$row[pid]' "); $country_clicks = mysql_query("select count(country) as clicks, country from hits where is_click = 1 and pub_id = '$row[pid]' GROUP BY country order by clicks desc"); mysql_query("delete from country_clicks where pid = '$row[pid]' "); while($rc = mysql_fetch_assoc($country_clicks)){ mysql_query("insert into country_clicks set clicks = '$rc[clicks]' , country = '$rc[country]', pid = '$row[pid]', updated = CURDATE() "); } } mysql_free_result($ws); // adv info $advertisement_ids = mysql_query("select adv_id from advertisersinfo"); while($ro = mysql_fetch_assoc($advertisement_ids)){ $clicksToday = mysql_result(mysql_query("select count(hit_id) from hits where adv_id = '$ro[adv_id]' and is_click='1' and is_sale='0' and `date` = CURDATE()"),0,0); $impressionsToday = mysql_result(mysql_query("select count(hit_id) from hits where adv_id = '$ro[adv_id]' and is_click='0' and is_sale='0' and `date` = CURDATE()"),0,0); $conversionsToday = mysql_result(mysql_query("select count(hit_id) from hits where adv_id = '$ro[adv_id]' and is_sale='1' and `date` = CURDATE()"),0,0); mysql_query("update advertisersinfo set clicksToday = $clicksToday, clicksTotal = (clicksTotal + $clicksToday), impressionsToday = $impressionsToday, impressionsTotal = (impressionsTotal + $impressionsToday), conversionsTotal = (conversionsTotal + $conversionsToday) where adv_id = '$ro[adv_id]' "); } mysql_free_result($advertisement_ids); // targeted_ads $cmp_ids = mysql_query("select cmp_id from adv_campaign"); while($ro = mysql_fetch_assoc($cmp_ids)){ $clicksToday = mysql_result(mysql_query("select count(hit_id) from hits where cmp_id = '$ro[cmp_id]' and is_click='1' and `date` = CURDATE()"),0,0); mysql_query("update adv_campaign set clicksToday = $clicksToday, clicksTotal = (clicksTotal + $clicksToday), remaining_budget = (remaining_budget - expense_today) where cmp_id = '$ro[cmp_id]' "); //camp_appeared $camp_appeared = mysql_query("select distinct publishersinfo.url, publishersinfo.pid from publishersinfo, hits where hits.cmp_id= '$ro[cmp_id]' and hits.pub_id=publishersinfo.pid order by hits.hit_id, hits.pub_id"); mysql_query("delete from camp_appeared where cmp_id= '$ro[cmp_id]' "); while($cmp = mysql_fetch_assoc($camp_appeared)){ mysql_query(" insert into camp_appeared set url = '$cmp', pid = '$cmp[pid]', cmp_id = '$ro[cmp_id]', updated = curdate() "); } } mysql_free_result($cmp_ids); /* $as = mysql_query("select ad_id from publishers_adspaces"); while($row = @mysql_fetch_assoc($as)){ $max_one_day_clicks = mysql_result(mysql_query("SELECT count(hit_id) as total from hits where is_click=1 and ad_id='$row[ad_id]' group by date order by total desc limit 1"),0,0); mysql_query("update publishers_adspaces set hits = $max_one_day_clicks "); } mysql_free_result($as); */ $users = mysql_query(" select uid from users where utype = 'pub+adv' "); while($r = mysql_fetch_assoc($users)){ $price = mysql_result(mysql_query("select sum(h.click_price) as price from publishersinfo pi inner join hits h on pi.pid = h.pub_id where pi.uid = '$r[uid]' and h.cmp_id <> 0 and h.date=curdate() and h.is_click=1 "),0,0); mysql_query("delete from pub_earningstoday where uid = '$r[uid]' "); mysql_query("insert into pub_earningstoday set updated = CURDATE(), uid = '$r[uid]', price = '$price' "); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/291346-help-urgently-needed-resolving-php-cron-file-errors/ Share on other sites More sharing options...
boompa Posted September 29, 2014 Share Posted September 29, 2014 What is the line in your crontab for running this script? Quote Link to comment https://forums.phpfreaks.com/topic/291346-help-urgently-needed-resolving-php-cron-file-errors/#findComment-1492370 Share on other sites More sharing options...
JewelsPiper Posted September 29, 2014 Author Share Posted September 29, 2014 thanks for your reply just this set to run once per day /home2/net2you/public_html/2xx.co.uk/include/CronStats.php Quote Link to comment https://forums.phpfreaks.com/topic/291346-help-urgently-needed-resolving-php-cron-file-errors/#findComment-1492375 Share on other sites More sharing options...
JewelsPiper Posted September 29, 2014 Author Share Posted September 29, 2014 also file permissions on CronStats.php file is 754 Quote Link to comment https://forums.phpfreaks.com/topic/291346-help-urgently-needed-resolving-php-cron-file-errors/#findComment-1492376 Share on other sites More sharing options...
ginerjm Posted September 29, 2014 Share Posted September 29, 2014 Turn on error checking - you have it off. Then setup your environment (if nec.) so that you can run this script manually and see those error messages on screen. They look like simple syntax/typing errors so you really need to clean them up. Quote Link to comment https://forums.phpfreaks.com/topic/291346-help-urgently-needed-resolving-php-cron-file-errors/#findComment-1492380 Share on other sites More sharing options...
JewelsPiper Posted September 29, 2014 Author Share Posted September 29, 2014 thanks I included error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); to the top of page just under <?php the page is just blank when I go to it, the browser shows it as page loaded ok.... Quote Link to comment https://forums.phpfreaks.com/topic/291346-help-urgently-needed-resolving-php-cron-file-errors/#findComment-1492385 Share on other sites More sharing options...
JewelsPiper Posted September 29, 2014 Author Share Posted September 29, 2014 the errors I get from the cron are sent to me via email as ive set the cron up to email the results to me Quote Link to comment https://forums.phpfreaks.com/topic/291346-help-urgently-needed-resolving-php-cron-file-errors/#findComment-1492386 Share on other sites More sharing options...
JewelsPiper Posted September 29, 2014 Author Share Posted September 29, 2014 ok seem to have it working now I added env php -q /home2/net2you/public_html/2xx.co.uk/include/CronStats.php thank you so much for all your help guys Quote Link to comment https://forums.phpfreaks.com/topic/291346-help-urgently-needed-resolving-php-cron-file-errors/#findComment-1492390 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.