By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,165 Members | 1,916 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,165 IT Pros & Developers. It's quick & easy.

Fopen() wont work from crontab

P: n/a
Hi,

I have a script that calls an fopen() on an external URL.
I can run the script from the server as an url fine.
When however the script should be run from crontab, it does not work.
I get

Warning: fopen(): URL file-access is disabled in the server configuration
in [php-file]

Warning: fopen(http://[url].xml): failed to open stream: no suitable
wrapper could be found in [php-file] on line 66
I have set allow_url_fopen On, but it still wont work. Any Idea what could
cause that?

thanks

Oliver

Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Oliver Spiesshofer wrote:
I can run the script from the server as an url fine.
When however the script should be run from crontab, it does not work.
I get

Warning: fopen(): URL file-access is disabled in the server configuration
in [php-file]

(snip)

On my system I have /two/ different php.ini files; one for apache and
the other for command-line.

apache: /etc/php4/apache/php.ini
cmd-line: /etc/php4/cgi/php.ini

On my system they both have "allow_url_fopen = On"

Try the command-line equivalent of phpinfo():

$ php -i | grep allow_url_fopen

HTH
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2

P: n/a
Just a shot in the dark, but what user is the cron running under? try
running the cron under same user as apache.

--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Oliver Spiesshofer" <ol****@email.com> wrote in message
news:Xn***************************@63.223.5.254...
Hi,

I have a script that calls an fopen() on an external URL.
I can run the script from the server as an url fine.
When however the script should be run from crontab, it does not work.
I get

Warning: fopen(): URL file-access is disabled in the server configuration
in [php-file]

Warning: fopen(http://[url].xml): failed to open stream: no suitable
wrapper could be found in [php-file] on line 66
I have set allow_url_fopen On, but it still wont work. Any Idea what could
cause that?

thanks

Oliver

Jul 17 '05 #3

P: n/a
thanks. this really helped me. I have two different also, which I did not
realize. I changed both and now it worked!

I am running gentoo linux. and the /etc/php directories contains two sub-
dirs, apache2-php4 and cli-php4 with each a php.ini

Oliver

Pedro Graca <he****@hotpop.com> wrote in
news:c0*************@ID-203069.news.uni-berlin.de:

On my system I have /two/ different php.ini files; one for apache and
the other for command-line.

apache: /etc/php4/apache/php.ini
cmd-line: /etc/php4/cgi/php.ini

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.