PDA

View Full Version : How to solve this (Include) issue in PHP



WomenXtra
09-14-2006, 08:54 AM
Hi web developers,

I am a newbie and stuck big big time!

My site has 3 includes on every page : the header.php, footer.php and the left_menu.php.

The includes for some reason used to work on one of the hosting servers. when I passed on the files to my friend to upload on their server - the content of the pages would show. but the none of the include files would display.

no error message
and no sign of anything wrong.

I checked the php config details..and it shows: vertual directory DISABLED!

NOW! could this be the reason? or am I missing something else?

Also, the files were not placed in the wwwroot folder, they were under: wwwroot/testing/

do i need to enable anything in directory level?

I am very lost and any suggestions would be really appreciated .

thanks
Tala

jtracking
09-14-2006, 09:23 AM
I'd guess and it's most likely that your paths to your include files are not accurate in your main page.

Check very carefully and you'll probably find that's the case. I can't count how many times this happens to me right up to yesturday.

Let me know.

JuniorOnline
09-14-2006, 03:21 PM
Hiya

ok, i need your help please, as I am feeling Xtremly lost!

my friend's API = Apache
mine is: CGI

does this make a difference why the files are not showing on his server?

What sort of modifications are needed for the files in order for them to function on his server?


thanks,
Tala

JuniorOnline
09-14-2006, 03:31 PM
when it comes to server side includes - its usually configured to allow/enable .shtml and html files to work. but my include files are not those. they are .php - does that mean I need to enable the CGI scripting side of things in order for it to work?

please please help!

sands
09-14-2006, 08:55 PM
they are .php - does that mean I need to enable the CGI scripting side of things in order for it to work?
No, for PHP includes all you need is PHP. The file extension should be .php

JuniorOnline
09-15-2006, 04:35 AM
so why the files are not showing?
is there something I need to look into?

there are no error messages..thats the problem..

speed
09-15-2006, 05:03 AM
On the server it doesn't work on:

Create a file called test1.php


<?php
include('test2.php');
echo "Test 1
\n";
?>

In the same directory create a file called test2.php


<?php
echo "Test 2
\n";
?>

In your browser access test1.php, do you see 2 lines?

If the answer is yes then it's your paths are wrong in the includes if the answer is no then it's a PHP/Server issue.

JuniorOnline
09-15-2006, 05:15 AM
ok will do.. thanks a lot for getting back to me so quick!

JuniorOnline
09-17-2006, 07:47 AM
hi again,

the php files are not showing.. any ideas what do i need to do to the apache server to enable them to show?

thanks
Tala

speed
09-17-2006, 08:08 AM
If you access test2.php do you see 1 line of text, source, a download or nothing?

Assuming nothing for test2.php have you tried changing it's permissions so that it is not group writable? Does that help?

Do you know if this server in fact has PHP on it?

PS. Replied to PM

profsite
09-22-2006, 12:42 PM
hi
there may be many reasons for ur problem
1.)your cgi management is disabled plz enable it first.
2.)your one of three files header.php,left.php or footer.php has some code which require that needs to be extra script to be instal like gd library etc....

if u still face problem after this u can contact me at:
profsite-at-aol.com

JuniorOnline
09-25-2006, 04:16 AM
thanks a lot profsite - Speed has managed to sort it out for me. I also learned a lesson from all of this: getting ALL the facts before making a start on any task. The IT department was so stupid, they had no clue what the client needed in the first please.

all sorted now though

many thanks again:)

lgoss
10-12-2006, 09:42 AM
but use the require() function instead of include(). The include() function generates a warning (but the script will continue execution) while the require() function generates a fatal error (and the script execution will stop after the error). You don't want your scripts to continue executing if files are missing or misnamed. Just a little tip.

kgun
10-12-2006, 10:37 AM
Do they use php.ini where they set include paths?