Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
730 views
in Technique[技术] by (71.8m points)

trying to turn on allow_url_fopen by putting php.ini in wordpress root does not work

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.

I get this error

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

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

That would work, but it wont.

Is there anyway to get this to work?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try to add this code to your .htaccess file:

php_value allow_url_fopen On

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...