UnitedForums - UK Web Hosting Forum UnitedHosting Community Hosting Forums
Network and Server StatusCustomer SupportUK Web Hosting
UnitedHostingUnitedHosting Sitemap UK Hosting ForumUK Web HostingWeb Hosting ForumsUK Reseller HostingWeb Host CommunityUK Managed Dedicated ServersHosting Help and SupportUK Domain Name Registration

Go Back   UnitedForums.co.uk > UnitedHosting Community > Website Development & Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 9th June 2008, 08:50 PM   #1 (permalink)
ngray
Registered User
 
ngray's Avatar
 
Join Date: Mar 2006
Location: The dark side of the moon
Posts: 337
Send a message via Skype™ to ngray
PHP5 include problems since upgrade

I've got a support ticket open for this, but has anyone else had any similar problems to this:

<?php
include("/home/XXXX/somefile.inc")
?>
<!- rest of page ->

Gives an error now,
Failed opening '/home/XXXX/somefile.inc' for inclusion (include_path='.:/php/includes:/usr/share/php:/usr/share/pear') in /home/virtual/siteXXX/XXX/var/www/html/webpage.php on line 1

And yes the file
/home/XXXX/somefile.inc does have Read permissions and can be opened from the command prompt.

This was all tested and working with PHP5 prior to the upgrades.

I hope someone can help, I'm tearing my hair our
__________________
Splattt there goes the 8:15 pie right on time. I hate mondays (Garfield)

If you drive you should be Smart Driving

Paranormal ghost map of the UK Thames Valley Paranormal Group
ngray is offline   Reply With Quote
Old 9th June 2008, 09:15 PM   #2 (permalink)
percepts
Senile Member
 
percepts's Avatar
 
Join Date: Mar 2005
Posts: 1,009
The file is looked for relative to the current working directory.
So change the path to a relative path to either the cwd or to the directory the script is in.
__________________
An old dog learning new tricks
percepts is offline   Reply With Quote
Old 9th June 2008, 09:17 PM   #3 (permalink)
ngray
Registered User
 
ngray's Avatar
 
Join Date: Mar 2006
Location: The dark side of the moon
Posts: 337
Send a message via Skype™ to ngray
Hmm slight problem there, it's deliberately in the home directory which is not relative to the main html due to the links. It worked fine in PHP5 before the upgrades.

If I have to move it that's a heck of a lot of work as there's a huge amount of code behind this which was all working fine.
__________________
Splattt there goes the 8:15 pie right on time. I hate mondays (Garfield)

If you drive you should be Smart Driving

Paranormal ghost map of the UK Thames Valley Paranormal Group
ngray is offline   Reply With Quote
Old 9th June 2008, 09:19 PM   #4 (permalink)
percepts
Senile Member
 
percepts's Avatar
 
Join Date: Mar 2005
Posts: 1,009
or if you had set something in php.ini to create another default php include directory, then it could have disappeared in the update. i.e. there are some default directories php looks in for includes. So the original statement may have worked because of the defaults and not because of the url in your statement.
__________________
An old dog learning new tricks
percepts is offline   Reply With Quote
Old 9th June 2008, 09:21 PM   #5 (permalink)
percepts
Senile Member
 
percepts's Avatar
 
Join Date: Mar 2005
Posts: 1,009
Quote:
Originally Posted by ngray View Post
Hmm slight problem there, it's deliberately in the home directory which is not relative to the main html due to the links. It worked fine in PHP5 before the upgrades.

If I have to move it that's a heck of a lot of work as there's a huge amount of code behind this which was all working fine.
Well modify your php.ini to set that directory as one of the include paths in addition to the ones already set in include_path
__________________
An old dog learning new tricks
percepts is offline   Reply With Quote
Old 9th June 2008, 09:22 PM   #6 (permalink)
pursuit
Registered User
 
Join Date: Feb 2006
Location: London, UK
Posts: 282
been using include hundreds of time but never remember there is a need to use the asolute path. if the file to be included is in the same folder as the file that includes it, then there is no need to have any path there, or if it is in a subfolder relative to the main file, then path should be "sub-folder/file-to-be-included". not sure this applies to you siyuation but thats what I do.

------
not realised there were quite a few post exchanges while i was typing. i would rather define a path in a common file so that the path could be changed in one single place in case changing server etc.

Last edited by pursuit : 9th June 2008 at 09:30 PM.
pursuit is offline   Reply With Quote
Old 9th June 2008, 09:50 PM   #7 (permalink)
percepts
Senile Member
 
percepts's Avatar
 
Join Date: Mar 2005
Posts: 1,009
Quote:
Originally Posted by pursuit View Post
not realised there were quite a few post exchanges while i was typing. i would rather define a path in a common file so that the path could be changed in one single place in case changing server etc.
agreed, that is another option but could involve code changes depending on how the site was written.

Just don't forget to set the correct path for the include of your config.inc file
__________________
An old dog learning new tricks
percepts is offline   Reply With Quote
Old 9th June 2008, 10:16 PM   #8 (permalink)
Simon
Dedicated to life!
 
Simon's Avatar
 
Join Date: Jul 2005
Location: 36°38'4.48"N - 4°42'18.52"W
Posts: 2,058
Send a message via MSN to Simon Send a message via Yahoo to Simon Send a message via Skype™ to Simon
Quote:
Originally Posted by ngray View Post
Failed opening '/home/XXXX/somefile.inc' for inclusion (include_path='.:/php/includes:/usr/share/php:/usr/share/pear') in /home/virtual/siteXXX/XXX/var/www/html/webpage.php on line 1
If I had to guess I would say that your site is no longer running in high security..
In high security mode I wouldn't expect to see any paths of the form /home/virtual/siteXXX/
__________________
Freelance PHP Programming
__________________
Simon is offline   Reply With Quote
Old 9th June 2008, 10:24 PM   #9 (permalink)
ngray
Registered User
 
ngray's Avatar
 
Join Date: Mar 2006
Location: The dark side of the moon
Posts: 337
Send a message via Skype™ to ngray
Quote:
Well modify your php.ini to set that directory as one of the include paths in addition to the ones already set in include_path
Done that already, in fact Tony did it for me, and you can see it in effect when you run php -i but the error still lists a include_path that DOESNT have this directory in it, as you'll see from my original post.
__________________
Splattt there goes the 8:15 pie right on time. I hate mondays (Garfield)

If you drive you should be Smart Driving

Paranormal ghost map of the UK Thames Valley Paranormal Group
ngray is offline   Reply With Quote
Old 9th June 2008, 10:30 PM   #10 (permalink)
MrBen
Munky!
 
MrBen's Avatar
 
Join Date: Sep 2003
Location: nr Woking, England
Posts: 2,597
I had this problem on a couple of sites after the upgrade on Sunday morning. Simon fixed it up but didn't say what the problem/resolution was.

Ben
__________________
Veterinary Practice Management System by SoftFooding
Internet Data Usage Calculator: Estimate your monthly bandwidth usage for your Internet connection.
MrBen is offline   Reply With Quote
Old 9th June 2008, 10:32 PM   #11 (permalink)
percepts
Senile Member
 
percepts's Avatar
 
Join Date: Mar 2005
Posts: 1,009
Quote:
Originally Posted by ngray View Post
Done that already, in fact Tony did it for me, and you can see it in effect when you run php -i but the error still lists a include_path that DOESNT have this directory in it, as you'll see from my original post.
Has he? the include path is not showing /home/xxxxx as one of the paths.

And /home/xxxxx is an alias of some kind. Try using /var/www/XXXXX in the php.ini include_path
__________________
An old dog learning new tricks
percepts is offline   Reply With Quote
Old 9th June 2008, 10:35 PM   #12 (permalink)
percepts
Senile Member
 
percepts's Avatar
 
Join Date: Mar 2005
Posts: 1,009
infact the error message looks like it is pre-pending /var/www/html with /home/virtual/siteXXX/XXX/ which looks a bit odd to me.
__________________
An old dog learning new tricks
percepts is offline   Reply With Quote
Old 9th June 2008, 10:39 PM   #13 (permalink)
ngray
Registered User
 
ngray's Avatar
 
Join Date: Mar 2006
Location: The dark side of the moon
Posts: 337
Send a message via Skype™ to ngray
Well, I tried a few (no, 100) things. In php.ini and php -i /var/www/html is in the include_path so I moved the files from /home/XXXX to /var/www/html but it still doesn't look there for pages in subdirectories. And the protected pages are all in subdirectories. And no, relative paths didn't work either. eg. page in subdirectory includes ../somefile.inc

This is why I've always in 8 years put include files in a specific place and pointed to them with an absolute path. It's worked well in all that time and it worked when I tested with PHP5 prior to the upgrades, it just don't work now and this is a national site with thousands of members and even thousands more regular visitors.

This could be a show stopper for me.
__________________
Splattt there goes the 8:15 pie right on time. I hate mondays (Garfield)

If you drive you should be Smart Driving

Paranormal ghost map of the UK Thames Valley Paranormal Group

Last edited by ngray : 9th June 2008 at 10:40 PM. Reason: further
ngray is offline   Reply With Quote
Old 9th June 2008, 11:15 PM   #14 (permalink)
UH-Matt
Administrator
 
UH-Matt's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 8,135
Neale

I have tony working 100% on your ticket alone to assist as much as we can. We'll make sure your site is fixed
__________________
.
Matt
UnitedHosting Staff

For official support please use our helpdesk at UnitedSupport.co.uk

UnitedHosting proudly hosting more than 20,000 sites since 1998.
UH-Matt is offline   Reply With Quote
Old 9th June 2008, 11:16 PM   #15 (permalink)
pursuit
Registered User
 
Join Date: Feb 2006
Location: London, UK
Posts: 282
i kind of seem like walking into a wonderland...this has never occured to me. i always take it for granted that php understand very well where to look for the files that i want it to. for example, if webpage.php is located under webroot, and its first line is to include a file in a subfolder that is directly under webroot, say, includes, then the include path would simply and exactly be:
include("includes/file-to-be-included.php");
no absolute path has ever been used. this works all the time on all sorts of servers (linux, windows apache/IIS).
a .htaccess (apache only) in that includes folder would make sure all files under that subfolderare protected.

Last edited by pursuit : 9th June 2008 at 11:20 PM.
pursuit is offline   Reply With Quote
Old 9th June 2008, 11:26 PM   #16 (permalink)
ngray
Registered User
 
ngray's Avatar
 
Join Date: Mar 2006
Location: The dark side of the moon
Posts: 337
Send a message via Skype™ to ngray
Well, Tony got it fixed for me, thanks Tony and thanks Matt, and for everyone else who contributed.

I think this one has to go to the top of the "post upgrade support issues". In the end, for anyone having the same problem, it was as usual something silly I'd forgotten.

The subdirectories had their own .htaccess mods to force php5 and that was forcing it to read the wrong php.ini which didn't have the /home/XXXX in it along with /var/www/html.

Tony, have a large beer on me! Once again I'm reminded why I use UH. Can you imagine if I'd still been with *cough* 1&1 pfft.
__________________
Splattt there goes the 8:15 pie right on time. I hate mondays (Garfield)

If you drive you should be Smart Driving

Paranormal ghost map of the UK Thames Valley Paranormal Group
ngray is offline   Reply With Quote
Old 9th June 2008, 11:28 PM   #17 (permalink)
UH-Matt
Administrator
 
UH-Matt's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 8,135
Ahhhhh!

We use a script to automatically take out the php5-script lines from .htaccess in the main html folder of sites, as part of the upgrade. But in subdirectories and subfolders we can't do it.
__________________
.
Matt
UnitedHosting Staff

For official support please use our helpdesk at UnitedSupport.co.uk

UnitedHosting proudly hosting more than 20,000 sites since 1998.
UH-Matt is offline   Reply With Quote
Old 9th June 2008, 11:58 PM   #18 (permalink)
pursuit
Registered User
 
Join Date: Feb 2006
Location: London, UK
Posts: 282
to make the situation even worse is that the .htaccess is hidden by default - out of sight out of mind!
pursuit is offline   Reply With Quote
Old 10th June 2008, 12:22 AM   #19 (permalink)
ngray
Registered User
 
ngray's Avatar
 
Join Date: Mar 2006
Location: The dark side of the moon
Posts: 337
Send a message via Skype™ to ngray
Now, why is that song "you had a bad day" stuck in my head?? If I'd lost this site I would've lost 33% of my annual turnover.

So thanks once again Tony and Matt
__________________
Splattt there goes the 8:15 pie right on time. I hate mondays (Garfield)

If you drive you should be Smart Driving

Paranormal ghost map of the UK Thames Valley Paranormal Group
ngray is offline   Reply With Quote
Old 10th June 2008, 09:37 AM   #20 (permalink)
jaik
Registered User
 
Join Date: Mar 2008
Posts: 8
Quote:
Originally Posted by UH-Matt View Post
Ahhhhh!

We use a script to automatically take out the php5-script lines from .htaccess in the main html folder of sites, as part of the upgrade. But in subdirectories and subfolders we can't do it.
Has an announcement been made about this? A number of our sites hosted on subdomains have been having problems too.

Previously I believe it was mentioned that leaving the PHP5 lines in the .htaccess files wouldn't cause any problems but would be depreciated and eventually be turned off. However, leaving those lines in seems to cause this issue with the directory path which is fairly serious for a lot of sites.
jaik is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 08:26 PM.

UK Web Hosting  |  UK Reseller Hosting  |  UK Dedicated Servers UnitedHosting  |  UnitedSupport  |  UnitedForums  |  SEO by vBSEO 3.0.0
Copyright © 1998-2008 United Communications Limited. All Rights Reserved. Registered in England and Wales 3651923 - VAT Reg No. 737662309