You are here:  » Warning: Cannot modify header information

Support Forum



Warning: Cannot modify header information

Submitted by Mahony on Thu, 2011-12-29 03:49 in

Hello David,

I get the error message below when I try to import a file a second time with the automation tool.

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in C:\Inetpub\vhosts\XXX\XXX\ptc\includes\automation.php on line 121
Warning: rename(../feeds/tmp,../feeds/vodafone) [function.rename]: File exists in C:\Inetpub\vhosts\XXX\XXX\ptc\includes\automation.php on line 96
Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\vhosts\XXX\XXX\ptc\includes\automation.php:121) in C:\Inetpub\vhosts\XXX\XXX\ptc\admin\automation_tool_run.php on line 18

safe_mode and open_basedir are disabled.

Can you help me please? Thanks!

Tony

Submitted by support on Thu, 2011-12-29 09:19

Hi Tony,

I'm not sure why the CURL library is not seeing the correct PHP configuration; I'll investigate that further for you and see if I can recreate it; in the mean time; I'll forward an alternative version of includes/automation.php to try which will suppress the warnings - together with some notes regarding how to confirm that it is still working correctly - PHP is probably just warning that the desitnation file exists but will still overwrite it... I'll follow up by email shortly...

Cheers,
David.
--
PriceTapestry.com

Submitted by Mahony on Thu, 2011-12-29 12:25

Hi David,

thanks for your fast reply. I don't understand it either.. because:
The first import "run" with the automation tool is perfect. I create a new job
named "vodafone" for example. It imports a file in the feeds folder and generates
a new entry in Feed Registration called "vodafone". So good so far.
But then comes the problem. If I run the job a second time, the errors get displayed.
Well not anymore since I replaced the old automation.php with yours. But the problem remains.
The old feed doesn't get overwritten. Rename is not performing its job.
It creates a new entry under Feed Registration named "tmp". If i run the job a third time..same
problem occurs. It doesn't update the "vodafone"-feed but it updates/overwrites the "tmp"-feed.

Cheers,
Tony

Submitted by support on Thu, 2011-12-29 12:33

Hi Tony,

Ah OK that is indicating that the particular PHP build is refusing to rename to a file that already exists - no problem we can insert an unlink call immediately prior which should do the trick.

To try this; in includes/automation.php, look for the following code at line 96:

      @rename($tmp,$config_feedDirectory.$job["filename"]);

(this is based on the version I sent to you; distribution is the same but without the @ warning suppression prefix)

...and REPLACE with:

      @unlink($config_feedDirectory.$job["filename"]);
      @rename($tmp,$config_feedDirectory.$job["filename"]);

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Mahony on Thu, 2011-12-29 14:08

Thanks a lot David! :)
That helped. I hope everything else will function as it should.

Cheers,
Tony