Jump to content

Recommended Posts

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);
Link to comment
https://forums.phpfreaks.com/topic/301283-function-doesnt-work-anymore/
Share on other sites

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.

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 by ginerjm
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.