PHP and WGET generate 0 byte files
am 07.11.2007 21:12:41 von Don69
I have a problem with PHP where wget generates 0 byte files. Below
is
the code that I use.
// ********************
$savedir = "/webroot/vifs/app/webroot/static/1234567890";
$url = "http://www.google.com";
$test = mkdir( $savedir, 0777);
exec("/usr/bin/wget -nH -nd -d -P$savedir $url");
// ********************
What I have noticed is that if the directory already exists, WGET
works fine. But if the directory is created prior to, as shown in
the
code, WGET generates a file of 0 bytes.
MKDIR always returns successfully.
I've tried inserting a SLEEP(5) after MKDIR and that does not help.
Would anyone know why this is happening?
Thanks
Re: PHP and WGET generate 0 byte files
am 08.11.2007 05:25:37 von Jake Barnes
On Nov 7, 3:12 pm, Don69 wrote:
> I have a problem with PHP where wget generates 0 byte files. Below
> is
> the code that I use.
>
> // ********************
> $savedir = "/webroot/vifs/app/webroot/static/1234567890";
> $url = "http://www.google.com";
>
> $test = mkdir( $savedir, 0777);
>
> exec("/usr/bin/wget -nH -nd -d -P$savedir $url");
> // ********************
>
> What I have noticed is that if the directory already exists, WGET
> works fine. But if the directory is created prior to, as shown in
> the
> code, WGET generates a file of 0 bytes.
>
> MKDIR always returns successfully.
>
> I've tried inserting a SLEEP(5) after MKDIR and that does not help.
>
> Would anyone know why this is happening?
Is safe mode on? I once had a problem with PHP not writing to a
directory that had been chmoded 0777. Turned out the problem was safe
mode. I turned it off and then things worked fine.
However, that is a long shot. My first guess is that this is more of a
wget issue than a PHP issue.
Re: PHP and WGET generate 0 byte files
am 08.11.2007 12:46:36 von bushido
On Nov 8, 3:12 am, Don69 wrote:
> I have a problem with PHP where wget generates 0 byte files. Below
> is
> the code that I use.
>
> // ********************
> $savedir = "/webroot/vifs/app/webroot/static/1234567890";
> $url = "http://www.google.com";
>
> $test = mkdir( $savedir, 0777);
>
> exec("/usr/bin/wget -nH -nd -d -P$savedir $url");
> // ********************
>
> What I have noticed is that if the directory already exists, WGET
> works fine. But if the directory is created prior to, as shown in
> the
> code, WGET generates a file of 0 bytes.
>
> MKDIR always returns successfully.
>
> I've tried inserting a SLEEP(5) after MKDIR and that does not help.
>
> Would anyone know why this is happening?
>
> Thanks
-P$savedir => -P $savedir