试图通过将 php.ini 放在 wordpress root 中来打开 allow_url_fopen 不起作用 [英] trying to turn on allow_url_fopen by putting php.ini in wordpress root does not work

查看:27
本文介绍了试图通过将 php.ini 放在 wordpress root 中来打开 allow_url_fopen 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我正在构建一个漂亮的裤子 wordpress 主题,并且该主题的一部分具有 php 获取图像宽度并使用这些数字来调整页面元素的大小.它在我的本地机器上运行良好,但是当我使用 cpanel 将主题放在我的托管服务器上时,它不起作用.

ok so, Im building a fancy pants wordpress theme and part of the theme has php getting image widths and using those numbers to resize page elements. It works fine on my local machine, but when I put the theme on my hosted server using cpanel, it doesnt work.

我收到此错误

Warning: getimagesize() [function.getimagesize]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/yoursite/public_html/wpsite/wp-content/themes/yourtheme/styles/login.php on line 7

Warning: getimagesize(http://yoursite.com/wpsite/wp-content/uploads/2012/11/logo1.png) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /home/yoursite/public_html/wpsite/wp-content/themes/yourtheme/styles/login.php on line 7

所以我想如果我在 wordpress 的根目录中创建了一个 php.ini 文件,里面有这个:

SO I thought if I made a php.ini file in the wordpress's root directory with this in it:

[PHP]
allow_url_fopen = 1

那行得通,但行不通.

有没有办法让它发挥作用?

Is there anyway to get this to work?

推荐答案

尝试将此代码添加到您的 .htaccess 文件中:

Try to add this code to your .htaccess file:

php_value allow_url_fopen On

如果它不起作用,您需要向您的托管服务提供商询问您的 php.ini 文件位置(如果存在).如果没有,请让他们在全局 php.ini 文件中为您设置.通常是/etc/php.ini

If it does not work, you will need ask your hosting provider about your php.ini file location, if it exists. If it does not, ask them to set this up for you in global php.ini file. Usually it's /etc/php.ini

这篇关于试图通过将 php.ini 放在 wordpress root 中来打开 allow_url_fopen 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆