adman4054 Posted June 1, 2016 Share Posted June 1, 2016 I recently moved a program from one server to another. The new server has php 5.4, the old one 5.3. I fire a cron job nightly that imports ads from an XML file into a MYSQL db. The code worked flawlessly for about three years. After moving it to the new server, it will not work UNLESS I change the date to the next day. I cant make heads, nor tails of it. So I'm wondering if the new version of PHP might have something to do with it. If I replace the $date in the local_file string with the actual name of the file, it works and like I said if I change the date on the XML file to the next day the script runs fine. Further, I know that the If (date ("1")! ! saturday...... is supposed to make the function not run on Satuday and Sunday, but now I want to run it everyday, so how would I change that? Always appreciate PHP Freaks public function import_ads() { if(date("l")!='Saturday' && date("l")!='Sunday') { //echo "test";die; $file_exists = FALSE; $i = 0; do { $date = date("m-d-y", time()); $local_file = $_SERVER['DOCUMENT_ROOT'].'/ads/import/FGH'.$date.'.xml'; if (file_exists($local_file)) { $this->load->model('Common'); $this->Common->delete_latest_ads(); $xml = simplexml_load_file($local_file); Quote Link to comment https://forums.phpfreaks.com/topic/301283-function-doesnt-work-anymore/ Share on other sites More sharing options...
ginerjm Posted June 1, 2016 Share Posted June 1, 2016 did the default timezone change on you? As for your Sat/Sun question - I'll let you ponder that solution to avoid embarrassing you in a public forum. Quote Link to comment https://forums.phpfreaks.com/topic/301283-function-doesnt-work-anymore/#findComment-1533352 Share on other sites More sharing options...
adman4054 Posted June 1, 2016 Author Share Posted June 1, 2016 Appreciate the response ginerjm. No the default timezone hasn't changed. As for the embarrassment, not too concerned with that. I own a software development company, but I find coding to be fascinating and trying to learn here and there with people who are gracious enough to spend the time helping people like me. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/301283-function-doesnt-work-anymore/#findComment-1533353 Share on other sites More sharing options...
ginerjm Posted June 1, 2016 Share Posted June 1, 2016 (edited) If you don't 'need' to filter OUT the Sat.Sun. data, simply don't. As for the rest of the problem, what doesn't work? The xml file read? Something after what you have shown us? Add some echo statements to ensure that what you want to be happening is really happening. Edited June 1, 2016 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/301283-function-doesnt-work-anymore/#findComment-1533356 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.