[PHP] problem with using include to a URL
We are currently experiencing issues with HTTP streams within PHP scripts. The following will present sample code that produces the error, error messages, and system information. Code that produces errors: ?php fopen(http://somewebhost.domain.gTLD/index.html;, r); $httpfile = file_get_contents(http://somewebhost.domain.gTLD/index.html;); include 'http://somewebhost.domain.gTLD/index.html'; ? Errors: Warning: fopen(http://somewebhost.domain.gTLD): failed to open stream: HTTP request failed! in /www/localwebhost.domain.gTLD/htdocs/test.php on line 2 Warning: file_get_contents(http://somewebhost.domain.gTLD/index.html): failed to open stream: HTTP request failed! Ø `· in /www/localwebhost.domain.gTLD/htdocs/test.php on line 3 Warning: main(http://somewebhost.domain.gTLD/index.html): failed to open stream: HTTP request failed! 0vÿ¿Øc xÀN1·~a1·þ: in /www/localwebhost.domain.gTLD/htdocs/test.php on line 4 Warning: main(): Failed opening 'http://somewebhost.domain.gTLD/index.html' for inclusion (include_path='.') in /www/localwebhost.domain.gTLD/htdocs/test.php on line 4 System info: System is running RedHat ES 3 with all the latest patches applied. The system has approx 512 virtual web sites configured in Apache. The Apache startup script changes the max file descriptors to a number higher than the RedHat default of 1024 (the number is currently set too 409600; we have also tried lower numbers such as 8192; please, note that Apache opens more than 1024 files upon startup and that the default setting is no longer an option; each virtual site has its own access log and error log). RPM list: kernel-smp-2.4.21-15.0.4.EL httpd-2.0.46-32.ent.3 php-4.3.2-11.1.ent php-mysql-4.3.2-11.1.ent PHP specifics: './configure' '--host=i386-redhat-linux' '--build=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--without-oci8' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--with-apxs2filter=/usr/sbin/apxs' We would like to know how to further troubleshoot this error to determine the reason why this error message started happening. We have other web servers configured identically (same version of RedHat distribution, same version of Apache, PHP etc.), with fewer web sites that are not experiencing this issue. Please, let us know if there is any additional information needed. Thank you, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with using include to a URL
From: Tim Wolgemuth [EMAIL PROTECTED] Code that produces errors: ?php fopen(http://somewebhost.domain.gTLD/index.html;, r); $httpfile = file_get_contents(http://somewebhost.domain.gTLD/index.html;); include 'http://somewebhost.domain.gTLD/index.html'; ? Errors: Warning: fopen(http://somewebhost.domain.gTLD): failed to open stream: HTTP request failed! in /www/localwebhost.domain.gTLD/htdocs/test.php on line 2 Is allow_burl_fopen enabled? It's the same error for all three attempts, basically. It simply cannot connect to the HTTP site. you're sure the site is up, right? PHP is running as the web server, does that have access to the http:// site you're requesting? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with using include to a URL
We do have allow_url_fopen set to be on. I can not find any docs. on allow_burl_fopen. Was that a typo or where can I find info for that variable? PHP is working fine if we do the includes like this: include '/somepath/somefile.php'; The URL that we are trying to get to is on the same box. If I am on that box I can use a text browser to it see the file that I am trying to include. Any other help? Tim John Holmes wrote: From: Tim Wolgemuth [EMAIL PROTECTED] Code that produces errors: ?php fopen(http://somewebhost.domain.gTLD/index.html;, r); $httpfile = file_get_contents(http://somewebhost.domain.gTLD/index.html;); include 'http://somewebhost.domain.gTLD/index.html'; ? Errors: Warning: fopen(http://somewebhost.domain.gTLD): failed to open stream: HTTP request failed! in /www/localwebhost.domain.gTLD/htdocs/test.php on line 2 Is allow_burl_fopen enabled? It's the same error for all three attempts, basically. It simply cannot connect to the HTTP site. you're sure the site is up, right? PHP is running as the web server, does that have access to the http:// site you're requesting? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with using include to a URL
From: Tim Wolgemuth [EMAIL PROTECTED] We do have allow_url_fopen set to be on. I can not find any docs. on allow_burl_fopen. Was that a typo or where can I find info for that variable? sorry, that was a typo. Apparently my spell checker thinks burl is a better word than url. :) PHP is working fine if we do the includes like this: include '/somepath/somefile.php'; The URL that we are trying to get to is on the same box. If I am on that box I can use a text browser to it see the file that I am trying to include. So is there any reason you're not using the above method? You realize that by including it through HTTP, you're only getting the _result_ of the PHP file? If you're PHP file does not produce any output, maybe that's the source of this problem... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with using include to a URL
This is the way that the customer waits to do it. Here is the sample code that is being included: ? print this is a test2BR; ? Tim John Holmes wrote: From: Tim Wolgemuth [EMAIL PROTECTED] We do have allow_url_fopen set to be on. I can not find any docs. on allow_burl_fopen. Was that a typo or where can I find info for that variable? sorry, that was a typo. Apparently my spell checker thinks burl is a better word than url. :) PHP is working fine if we do the includes like this: include '/somepath/somefile.php'; The URL that we are trying to get to is on the same box. If I am on that box I can use a text browser to it see the file that I am trying to include. So is there any reason you're not using the above method? You realize that by including it through HTTP, you're only getting the _result_ of the PHP file? If you're PHP file does not produce any output, maybe that's the source of this problem... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with using include to a URL
From: Tim Wolgemuth [EMAIL PROTECTED] This is the way that the customer waits to do it. Here is the sample code that is being included: ? print this is a test2BR; ? Well tell the customer he's wrong! ;) Seriously... what if you try something like include('http://www.google.com'), does that work? Is there any kind of weird redirection in the page you're requesting? (obviously not if it's really just that sample code, though.) If all else fails, search Google for your error message and see what pops up. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with using include to a URL
When I run it from the command line it works. But if I run it through Apache it does not work. Tim John Holmes wrote: From: Tim Wolgemuth [EMAIL PROTECTED] This is the way that the customer waits to do it. Here is the sample code that is being included: ? print this is a test2BR; ? Well tell the customer he's wrong! ;) Seriously... what if you try something like include('http://www.google.com'), does that work? Is there any kind of weird redirection in the page you're requesting? (obviously not if it's really just that sample code, though.) If all else fails, search Google for your error message and see what pops up. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php