Error cron file_get_contents ()

I have a php file that uses file_get_contents()

It works fine in the browser, but does not work with the following error on startup as a cron job:

Warning: file_get_contents (): URL file access is disabled on the configuration server in /path/to/the/phpfile.php on line 22

This is what I use:

/ usr / bin / php5 -q /path/to/the/phpfile.php

Iv'e already installed allow_url_fopen = truein php.ini, but this does not seem to have any effect.

Everything works fine in the browser. How can this be fixed?

+3
source share
5 answers

, . file_get_contents , . , , .

+1
  • Do php --info | more
  • , php.ini ( 5 )
  • , php.ini

--php-ini /path/to/ini (do man php), ini, .

+2

, Linux PHP ( php.ini). , Debian :

/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini

PHP- - ( apache) .

.

+1

You may inadvertently have more than one copy of PHP and / or php.ini in the system. Do you have administrator rights on a PC? Do a global search phpand see what happens.

0
source

Instead of using php -q, use php -cron in your cron configuration. This works for me.

0
source

Source: https://habr.com/ru/post/1748564/


All Articles