在unix上运行的PHP脚本中出现奇怪的错误

时间:2011-06-21 21:10:26

标签: php

我正在unix shell中运行php,我收到以下错误。 该脚本是一个Web scraper,如果我访问它,它在我的主机上运行正常。但是我想把它作为一个cron工作来运行,我该怎么办?

  

警告:file_get_contents(http://www.lomamatkat.fi/iframes/last-minute-offers/?lastminute_next=50):无法打开流:在/ var / www / customers /中找不到合适的包装器第30行的lentovertailufi / public_html / matkat / script / lomamatkat.php   PHP警告:file_get_contents():在第30行的/var/www/customers/lentovertailufi/public_html/matkat/script/lomamatkat.php中的服务器配置中禁用了URL文件访问

3 个答案:

答案 0 :(得分:7)

更新您的php.ini文件,并将'allow_url_fopen'选项设置为'On'。

答案 1 :(得分:1)

如果您无法更改allow_url_fopen,请考虑使用curl(如果必须是php)或Wget

答案 2 :(得分:0)

转到php.ini并启用它或使用curl或其他一个http get函数。 file_get_contents被认为是对网址的危险系统调用,因为人们也可以将文件放入其中。