Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 7th August 2007, 23:16
bpmee bpmee is offline
Member
 
Join Date: Aug 2006
Posts: 86
Thanks: 3
Thanked 7 Times in 6 Posts
Unhappy Very frustrating Sudden PHP Include Error

Hi All,

I'm having a very frustrating PHP include error that just started recently.

Basically, I have .php pages in a directory with a PHP include call followed by some other html and code.

Here is a sample of what I am talking about:

PHP Code:
<?php $clientip $_SERVER['REMOTE_ADDR']; ?><?php include('http://www.domain.com/subfolder/content/section1.php?keyword=Los-angeles-cosmetic-surgery&yourip='.$clientip); ?>
The above is all on line 1 of my page. The page dynamically creates a page with an RSS feed I setup for the given keyword.

I checked my RSS feed source and it works fine. I was able to query it with my browser and the feed shows up. Also, I used lynx on my command line and the feed comes to the server successfully.

Now, however, I get the following error in my logs, and I am not sure why this is happening!

Code:
[Tue Aug 07 12:44:28 2007] [error] [client 64.151.124.29] PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening 'http://www.domain.com/subfolder/content/section1.php?keyword=Los-angeles-cosmetic-surgery&amp;yourip=64.151.124.29' for inclusion (include_path='.:/usr/share/pear') in /home/www/web758/web/subfolder/Los-angeles-cosmetic-surgery.php on line 1
When I try to open the above page in my browser or lynx, I simply get a blank page with the other html I have on the page AFTER the include call.

Note, the server is ASKING ITSELF for the include via http://www...etc. I am not including it using the local path (ie /web/subfolder/include.php). I have always used this method and never until a couple days ago did it cause any trouble.

I am using ISPConfig (of course! ) on Fedora Core 5 linux.

Note, I recently fixed some DNS issues with my server...The resolv.conf file was misconfigured and I had to change it to the proper values.

Fopen is on in my PHP.ini file - so I don't know why this is happening?

Any ideas? Thanks!
Reply With Quote
Sponsored Links
  #2  
Old 7th August 2007, 23:22
bpmee bpmee is offline
Member
 
Join Date: Aug 2006
Posts: 86
Thanks: 3
Thanked 7 Times in 6 Posts
Default Addendum

It seems to be happening on another server that has a similar configuration: any calls to external PHP includes do not work!
Reply With Quote
  #3  
Old 8th August 2007, 11:36
bpmee bpmee is offline
Member
 
Join Date: Aug 2006
Posts: 86
Thanks: 3
Thanked 7 Times in 6 Posts
Lightbulb Also these notes...

In anticipation of some sort of reply, I am supplying the following items which are currently configured on my server:

1) fopen is on.

2) openbasedir is commented out

3) I have not upgraded Apache recently.

4) I have not upgraded PHP recently.

5) I have tried rebooting network, httpd, named, and ispconfig_server numerous times.

I believe the issue might be DNS related, but I have no clue how to go about finding out how...

Why would only PHP have issues with DNS and not the rest of the server?

I am checking my resolv.conf files and configs at all my servers now, that are related to this problem...

Any replies or solutions are greatly appreciated!
Reply With Quote
  #4  
Old 8th August 2007, 12:19
bpmee bpmee is offline
Member
 
Join Date: Aug 2006
Posts: 86
Thanks: 3
Thanked 7 Times in 6 Posts
Default Found Solution!

Hi All,



I am having nearly the exact same problem, and I have banged my head against the wall for the past 2 days trying to solve it.



I have messed around with resolv.conf, rebooted all sorts of services, reconfigured etc...



Turns out it is rather simple, (isn't it always?? ) and I'm not taking credit for solving it but rather for finding someone's own solution:

http://www.mydigitallife.info/2006/0...pen-functions/

Follow the article, but for me, the part that matters was my user_agent setting in my PHP.ini.

So, I did the following:

Code:
vi /etc/php.ini
and scrolled down to my user_agent setting. It turns out that the server will not open an external URL or HTTP stream because the requesting user agent, as set by whatever version of PHP you are using is simply "PHP".

So, the server balks at requests from this user agent and does not process them.

so, I edited the user_agent setting and changed it from "PHP" to:

Code:
user_agent="Mozilla/4.0 (compatible; MSIE 6.0; BPMEESERVER NT 2.22)"
This effectively tells the server that a browser is requesting the page, not a script.

I named the OS "BPMEESERVER" so when I read my logs, I'll know that it is my box requesting various pages.

Hope this helps
Reply With Quote
The Following User Says Thank You to bpmee For This Useful Post:
falko (9th August 2007)
  #5  
Old 29th September 2007, 07:37
blu3ness blu3ness is offline
Junior Member
 
Join Date: Aug 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

or just use curl
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2 Freezes celtic Server Operation 31 28th May 2007 18:18
configuring IPTABLES firewall adityavpratap HOWTO-Related Questions 9 27th May 2006 22:42
Frustrated with ISPConfig install! woozyerdaddee Installation/Configuration 4 19th May 2006 04:38
Installation Fails... :( cyberstorm Installation/Configuration 1 15th January 2006 19:07
Install stop at uuwish, UUDeview SeaWolf Installation/Configuration 6 5th October 2005 00:53


All times are GMT +2. The time now is 10:52.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.