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

查看:98
本文介绍了试图通过将php.ini放到wordpress根目录中来打开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根目录中来打开allow_url_fopen不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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