allow_url_fopen已启用,但phpinfo已关闭

时间:2017-04-21 12:55:53

标签: php

由于我将服务器更新为PHP7或者为服务器启用了AutoSSL,因此我无法上传文件。我的错误如下

fopen(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0

我不知道allow_url_fopen = 0来自哪里,因为在全局php.ini和子域内的php.ini都使用说明

allow_url_fopen=On
allow_url_include = On

在phpinfo()中,我看到我的php.ini文件在哪里...

Configuration File (php.ini) Path   /opt/cpanel/ea-php70/root/etc
Loaded Configuration File   /opt/cpanel/ea-php70/root/etc/php.ini

当我打开这个php.ini文件时,我看到allow_file_fopen是“On”

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-fopen
allow_url_fopen = On

; Whether to allow include/require to open URLs (like http:// or ftp://) as fil$
; http://php.net/allow-url-include
allow_url_include = On

但在同一个phpinfo()文件中,我看到allow_file_fopen已关闭

Directive   Local Value Master Value
allow_url_fopen Off Off
allow_url_include   Off Off

从另一个堆栈交换线程我被告知尝试以下代码,结果证明它是OFF

if (ini_get("allow_url_fopen") == 'On') {
echo "allow_url_fopen is ON";
} else {
echo "allow_url_fopen is OFF";
}   

以前我通过在我的控制器中使用以下代码确实能够正常工作,但这不再适用于我不知道的原因

ini_set('allow_url_fopen',1);

我正在使用Laravel 5.2和Image干预包来处理上传的图像。正如我所说,这一切都在PHP7和AutoSSL之前完成

我错过了什么?

1 个答案:

答案 0 :(得分:2)

通过编辑“MultiPHP INI编辑器”部分,我能够找到WHM内部关闭allow_url_fopen的位置。从那里我选择了PHP7。启用allow_url_fopen的第一个选项。这解决了我的错误。

我无法通过SSH找到allow_url_fopen被禁用的位置。我想这是因为我不理解从PHP5到PHP7的升级过程,并且我通过cPanel只为每个帐户启用了PHP7,虽然Root仍然使用PHP5 for php.ini。