Control Web Panel

WebPanel => Information => Topic started by: alebal on August 04, 2016, 11:15:25 PM

Title: address error fwrite
Post by: alebal 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)));
fclose($file);


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/domain.com/sitemap.xml

But here /sitemap.xml

(http://alebalweb.com/temp/Schermata%20del%202016-08-05%2001:14:04.png)


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?
Title: Re: address error fwrite
Post by: Igor S. on August 10, 2016, 08:33:53 AM
Hello,
if do you want run script from crontab or command line, try t use full  pathes in a scripts.