Fopen() wont work from crontab

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Oliver Spiesshofer

    #1

    Fopen() wont work from crontab

    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

  • Pedro Graca

    #2
    Re: Fopen() wont work from crontab

    Oliver Spiesshofer wrote:[color=blue]
    > 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][/color]
    (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_fope n = 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 =--

    Comment

    • CountScubula

      #3
      Re: Fopen() wont work from crontab

      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" <oliver@email.c om> wrote in message
      news:Xns948BEA2 C28038oliverema ilch@63.223.5.2 54...[color=blue]
      > 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
      >[/color]


      Comment

      • Oliver Spiesshofer

        #4
        Re: Fopen() wont work from crontab

        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 <hexkid@hotpop. com> wrote in
        news:c0bmb9$15j r5r$1@ID-203069.news.uni-berlin.de:
        [color=blue]
        >
        > 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[/color]


        Comment

        Working...