PHP Linux path does not work

0

Very good, I want to change some routes from windows to Linux, to do verifications, and in Widnows I have these that work:

$BACKUP_PATH = "C:\\xampp\\htdocs\\deimos\\vista\\backup\\backup_";
$nowtimename = date('Y-m-d',time());
$fileName = $BACKUP_PATH.'db-backup-'.$nowtimename.'-'.'.sql';
$handle = fopen($fileName,'w+');
fwrite($handle,$return);

And in Linux as it would be, because I had to put the quad against the bar in Windows, I found it messy to understand it at the beginning, or I did it wrong but it works. I do not know what to say to you, but they advised me like that and I did so, but in Linux I do not know if it's a problem with the missing bars or because, but I have this:

$BACKUP_PATH = "/var/www/html/dcmcode/deimos/vista/backup";
$nowtimename = date('Y-m-d',time());
$fileName = $BACKUP_PATH.'db-backup-'.$nowtimename.'-'.'.sql';
$handle = fopen($fileName,'w+');
fwrite($handle,$return);
    
asked by Alberto Cepero de Andrés 12.06.2017 в 10:01
source

1 answer

0

The problem came from the server that hosted the website, the route is well written for Linux, but did not have write permissions for the user who accessed the website, once modified these, everything worked perfectly.

    
answered by 12.06.2017 в 17:07