navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

If your PHP includes suddenly stop working

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> General Web Development >> If your PHP includes suddenly stop working
Page: [1]
 
jaybee

 

Posts: 14191
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
If your PHP includes suddenly stop working - 3/16/2008 19:28:00   
Check to see if your host has just upgraded to PHP5.

This has happened to me a number of times in the past 3 months on different hosts. Pages suddenly start coming up with included bits missing for no obvious reason.

PHP5 either allows your host to disable URL or, it opens or installs that way as standard. Can't work out which as the hosts don't seem to have a clue. So if your include uses an absolute path http://www.xxxxx.ccc then you need to change it to relative. Do not start the relative address with a / though. It works in PHP4 but not 5.

< Message edited by jaybee -- 3/17/2008 8:41:53 >


_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?
treetopsranch

 

Posts: 1141
From: Cottage Grove, OR, USA
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/16/2008 21:20:51   
Thanks for the heads up on that one. I have one host that is always doing something with their servers without notifying me first.

_____________________________

Don from TreeTops Ranch, Oregon

"I've got a taste for quality and luxury"


(in reply to jaybee)
jaybee

 

Posts: 14191
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/17/2008 8:40:55   
They just don't get it that on some sites you don't need to keep logging in to the cpanel so posting upgrade messages in there is pointless. I've asked all of them why they can't just send out an email. Seems it's too much trouble.

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to treetopsranch)
jaybee

 

Posts: 14191
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/17/2008 16:12:46   
OK, after hours of research and banging my head on the desk, stupid here finally fell in. I can only put it down to too many sites to fix in a panic.

if you're using for example

<?php include("/includes/header.htm"); ?>
or
<?php include("http://www.yoursite.com/includes/header.htm"); ?>

this is when the trouble starts with PHP5.

Using HTTP no longer works.

Specifying the root by using / doesn't work. If the files are in the root then includes/header.htm does work but not if it's in a sub folder. You end up having to do the ../../ for pages in those which is a pain.

Or you can specify the full path, such as:

<?php include("home/var/www/root/html/includes/header.htm"); ?>

which is fine if you intend keeping your site on that host and they don't suddenly move you to a new server with a different config.

So if you were using /includes/xxxxx.xxx on any page at any level , instead use

<?php include($_SERVER['DOCUMENT_ROOT']."/includes/header.htm"); ?>




< Message edited by jaybee -- 3/17/2008 16:20:30 >


_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to jaybee)
BobbyDouglas

 

Posts: 5470
Joined: 5/15/2003
From: Arizona
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/17/2008 17:05:12   
What hosts are you using that doesn't notify you about these major changes?

PHP5 breaks many outdated programs. If programmers have kept the software up to date, a switch to PHP5 should work without any problems.

As far as the includes go, I don't believe PHP 5 did any major changes to the way includes were handled.

Here's a php4 and php5 example that shows that you can using http:// for an include. Sounds like your host may not have properly configured php 5... Might want to verify that they have setup allow_url_include in the php.ini file, I think that is a common mistake when setting up php5.

http://php5test.rp-s.com/phptest4/

and

http://php5test.rp-s.com/phptest5/

I've uploaded the phpinfo for both of the folders.

_____________________________

Arizona Web Design - Mr Bobs Web Design in Arizona
The Arizona Web Hosting Challenge

(in reply to jaybee)
womble

 

Posts: 5702
Joined: 3/14/2005
From: Living on the edge
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/17/2008 17:05:49   

quote:

ORIGINAL: jaybee

They just don't get it that on some sites you don't need to keep logging in to the cpanel so posting upgrade messages in there is pointless. I've asked all of them why they can't just send out an email. Seems it's too much trouble.


Yeah, I've got a host like that who expects me to be telepathic and know when I need to check the cPanel for messages! :)

quote:

Using HTTP no longer works.


Damn! An awful lot of mine do use HTTP IIRC. :)

_____________________________

~~ "A cruel god ain't no god at all" ~~
~~ Erase hate. Practice love. ~~
:)

(in reply to jaybee)
BobbyDouglas

 

Posts: 5470
Joined: 5/15/2003
From: Arizona
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/17/2008 17:07:51   
Also, you may be able to fix this yourself if your host won't help..

Put the following inside your .htaccess file:

allow_url_include On


_____________________________

Arizona Web Design - Mr Bobs Web Design in Arizona
The Arizona Web Hosting Challenge

(in reply to BobbyDouglas)
womble

 

Posts: 5702
Joined: 3/14/2005
From: Living on the edge
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/17/2008 17:14:49   
:) I'll give that a try Bobby - thanks.

It's not a lot of my sites that are affected I don't think. The main one I use upgraded a couple of months ago and did let me know and I've had no problems with that, but the host I have my nephew's site on which does use a lot of includes is a PITA. I only use them because they're very cheap, and as it's only for his personal site I didn't want to be paying out huge amounts. (He's only 9 yrs old, so he 'pays' me for doing the site for him in sweets :))



_____________________________

~~ "A cruel god ain't no god at all" ~~
~~ Erase hate. Practice love. ~~
:)

(in reply to BobbyDouglas)
jaybee

 

Posts: 14191
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/17/2008 18:39:24   
Unfortunately, this host is trying to keep the server speed up by refusing to allow http. It clobbered some of my includes and Mike Cherim's form now tells me I'm a spam bot. Sigh.

Luckily, the change I gave above works and should work on all hosts. Mike also has a new version of his form that gets around the false accusations.

I had been using /includes/filename.htm. All my pages are htm and parsed as php using htaccess.

They just stopped working. If I took off the / then it would work as long as the calling program was in the root. If it was in a subfolder then I had to use ../includes

I can't change anything on this host. Heck they won't even let me add sub domains. Hence the reason I now have a shiny new reseller account that will be getting used with a vengence as soon as I figure out the instruction manual. :)

The other hosts it happened on, I just shouted loudly at them for a day or so and they fixed it but this is 3 hosts in 3 months.

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to womble)
BobbyDouglas

 

Posts: 5470
Joined: 5/15/2003
From: Arizona
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/17/2008 19:06:54   
quote:

I can't change anything on this host.

- They won't even allow you to change it via htaccess?

quote:

they fixed it but this is 3 hosts in 3 months.

- Sounds like one of those cheapo hosts :) Care to post their company names?

quote:

Unfortunately, this host is trying to keep the server speed up by refusing to allow http.

- Properly configured, non-overloaded servers, should have no issues at all with this normal configuration.

_____________________________

Arizona Web Design - Mr Bobs Web Design in Arizona
The Arizona Web Hosting Challenge

(in reply to jaybee)
jaybee

 

Posts: 14191
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/17/2008 22:47:27   
This particular one is a very cheap host and to be fair, no, I don't want to post their name as for basic sites they are extremely good. It's only when you start to get clever that you come up against a wall but you can't expect much else for $20 a year.

The reason I got completely wound up is because, unfortunately for them, they were the third host to do the php switch and clobber my includes. Serverfly were the first and some very large client sites went belly up much to my horror.

What didn't help was they were on different servers and Serverfly did the migrations one at a time so as soon as I had one sorted then another one went.

Just to turn the knife a bit more, they then decided to move the first site I fixed to another server and screwed it all up again. They did this just as the second host installed PHP5 so I had another load to sort out.

This last lot just had reeeeeally bad timing. :)

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to BobbyDouglas)
BobbyDouglas

 

Posts: 5470
Joined: 5/15/2003
From: Arizona
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/18/2008 0:17:49   
Did you try that htaccess code?

The php5 upgrades sure aren't fun to deal with :)

We're looking at adding a custom switcher that allows clients to switch between php4/php5 versions directly via cPanel. I think this should be standard. Lots of old programs are still running perfectly fine on php4.

Our current e-mail program doesn't run on php5. We have to upgrade to their new version, which is completely different from the previous version, and changes the entire license scheme. We're currently looking to handle our e-mail some other way. We might move over to Exchange for our company e-mail, but would rather stick with all of the anti-spam stuff we have with our linux based mail server.

_____________________________

Arizona Web Design - Mr Bobs Web Design in Arizona
The Arizona Web Hosting Challenge

(in reply to jaybee)
jaybee

 

Posts: 14191
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: If your PHP includes suddenly stop working - 3/18/2008 6:40:55   
They have it set up so that certain things in htaccess get automatically commented out. It was driving me nuts, couldn't figure out why the comments kept appearing.

It's not a problem now that I've finally put my brain in gear and changed the include to use the PHP server Document Root which is really what I should have used in the first place. The form should be OK too as the new version checks for bots differently.

Plus, the whole shebang will be moving to my new host pretty soon anyway.

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to BobbyDouglas)
Page:   [1]

All Forums >> Web Development >> General Web Development >> If your PHP includes suddenly stop working
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts