cancel
Showing results for 
Search instead for 
Did you mean: 

File locations to make php work ?

Negger
Dabbler
Posts: 20
Registered: ‎04-08-2010

File locations to make php work ?

Hi, I'm completely new to website building, so please don't assume that I know the obvious!
I'm trying to insert the navbar into my webpage using php.
I've removed the navbar html code from the webpage and stored in in a separate file called navbar.php and loaded it to the cgi server .
This file contains nothing else other than the navbar html ?
Where I've removed the navbar from my webpage I have replaced it with:
<?php include("MyUserName@cshell.plus.net/navbar.php"); ?>
which should insert the navbar at this point ?
I've loaded this page to the normal htdocs folder ?
It is not working, and I've tried various permutations, Could anyone please answer any of the following:
Does the navbar.php require any other code than the basic navbar html?
Have I uploaded this to the correct place; the cgi server ?
Have I loaded the webpage to the correct place; the 'normal' htdocs' server ?
Is the path  "MyUserName@cshell.plus.net/navbar.php" absolutely correct ?
N.B. it took me several days to work out that adding ../ would get my images to load!!
Anything else I've missed out ?
Many thanks to anyone who can help.
9 REPLIES 9
jelv
Community Veteran
Posts: 26,786
Thanks: 990
Fixes: 10
Registered: ‎10-04-2007

Re: File locations to make php work ?

The include needs to be ccgi.username.plus.com/navbar.php
jelv (a.k.a Spoon Whittler)
   Why I have left Plusnet (warning: long post!)   
Broadband: Andrews & Arnold Home::1 (FTTC 80/20)
Line rental: Pulse 8 Home Line Rental (£14.40/month)
Mobile: iD mobile (£4/month)
Negger
Dabbler
Posts: 20
Registered: ‎04-08-2010

Re: File locations to make php work ?

Hi Jelv, Thanks for reply.
I've now changed the "Include" to :
<?php include("ccgi.username.plus.com/navbar.php"); ?>
but still no joy.
No error messages, just page loading without the navbar.
Any other thoughts ?
Regards
jelv
Community Veteran
Posts: 26,786
Thanks: 990
Fixes: 10
Registered: ‎10-04-2007

Re: File locations to make php work ?

What do you get if you put ccgi.username.plus.com/navbar.php in to the browser address bar?
jelv (a.k.a Spoon Whittler)
   Why I have left Plusnet (warning: long post!)   
Broadband: Andrews & Arnold Home::1 (FTTC 80/20)
Line rental: Pulse 8 Home Line Rental (£14.40/month)
Mobile: iD mobile (£4/month)
Negger
Dabbler
Posts: 20
Registered: ‎04-08-2010

Re: File locations to make php work ?

If I enter:
http://ccgi.grahammorris.plus.com/lhnavigation.php
then I get:
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: lhnavigation.php
If you think this is a server error, please contact the webmaster.
Error 500
ccgi.grahammorris.plus.com
Tue Aug 10 14:15:47 2010
Apache
spraxyt
Superuser
Superuser
Posts: 10,063
Thanks: 1,369
Fixes: 75
Registered: ‎06-04-2007

Re: File locations to make php work ?

Error 500 probably occurs because you haven't made the .php file executable. You need to change permissions to 0700 using your FTP client.
The CGI Upgrade FAQ stickied at the top of this board provides relevant information.
I think the problem with your webpage is because the page is on the homepages servers, and those servers do not understand PHP. The whole page would have to be on ccgi (and made executable) for it to work.
David
Negger
Dabbler
Posts: 20
Registered: ‎04-08-2010

Re: File locations to make php work ?

HI Spraxyt, Thanks for suggestion.
I'll change permissions first, see  what happens  and then move to other server.
If I do, presumably I will have to change file extension to .php from .html ?
If this works I will want to change all my html web pages over, does that mean I will effectively have to move the entire site over to the other server ?
What about my images folder  and the css file ?
Are there any other implications in this ?
Regards
Negger
Dabbler
Posts: 20
Registered: ‎04-08-2010

Re: File locations to make php work ?

I've changed the file permissions and altered the file to .php and moved to  the cgi server.
I'm now getting an unformatted page (no CSS ?) with the following 2 error messages where the navbar should be:
Warning: include(ccgi.grahammorris.plus.com/lhnavigation.php) [function.include]: failed to open stream: No such file or directory in /share/storage/02/gr/grahammorris/phptrial.php on line 115
Warning: include() [function.include]: Failed opening 'ccgi.grahammorris.plus.com/lhnavigation.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /share/storage/02/gr/grahammorris/phptrial.php on line 115
N.B. Line 115 is (I think !)  the inclusion statement :
<?php include("ccgi.grahammorris.plus.com/lhnavigation.php"); ?>
Is that any help ?
spraxyt
Superuser
Superuser
Posts: 10,063
Thanks: 1,369
Fixes: 75
Registered: ‎06-04-2007

Re: File locations to make php work ?

Line 115 needs to be
<?php include("lhnavigation.php"); ?>
That's the relative path from where phptrial.php is located to the included script.
Files which are to be parsed by PHP need to have a .php extension.
If you want to run your site from ccgi everything will have to be on there including css and images, with the right file paths for the server to find them. The main implication is that it is going to involve you in a lot of work.
David
Negger
Dabbler
Posts: 20
Registered: ‎04-08-2010

Re: File locations to make php work ?

Excellent - Thank you so much!
Changing the file path loaded the navbar, & loading the css file to the cgi server sorted the formatting. I think I should be able to work the rest out from here - Thank you again  Cheesy
If you want to run your site from ccgi everything will have to be on there including css and images, - I don't necessarily want to, but it looks as though I will have to, if I want these php navbars to work ?