Author Topic: address error fwrite  (Read 2292 times)

0 Members and 1 Guest are viewing this topic.

address error fwrite
« on: August 04, 2016, 11:15:25 PM »
Hi at all.

I have a php file that creates the sitemap. In the end, the file creates a sitemap.xml file in the site root.

Code: [Select]
$nome_file_index = "sitemap.xml";
chmod($nome_file_index, 0666);
$file = fopen($nome_file_index, "w") ;
fwrite($file, stripslashes(utf8_encode($elenco_sitemap)));

On cwp this thing does not seem to work ... does not save the file to the root of the site, but in the server root.

Not here /public_html/

But here /sitemap.xml

Something does not work ...

Not only with the sitemap file, but with any file created by php, from any script.

I noticed that if you launch the file manually, everything seems to work correctly.

The file is saved in the wrong place when, for example, is run by crontab.

Missing some configuration cwp? You can solve it without putting hand to all the files already created?

Re: address error fwrite
« Reply #1 on: August 10, 2016, 08:33:53 AM »
if do you want run script from crontab or command line, try t use full  pathes in a scripts.