Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-18-2006, 06:38 PM
Orion's Avatar
WebProWorld Veteran
 

Join Date: Sep 2003
Location: Halton Hills, ON
Posts: 595
Orion RepRank 2
Default HELP! including php file in subdirectory using SSI

that's what we're doing worked fine before upgrade to php5

now it doesn't work

I can include any php file in the same directory in the shtml and it works but as soon as you include a .php file from a subdirectory it stops functioning...

anyone have an idea how to solve this? we're thinking some setting in httpd.conf file.. but what and where? possibly in php.ini dunno???

HELP!
__________________
Ron Boyd
Web design & site management :: Ron's blog
Reply With Quote
  #2 (permalink)  
Old 09-18-2006, 06:56 PM
wige's Avatar
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,840
wige RepRank 4wige RepRank 4wige RepRank 4wige RepRank 4
Default

I can think of a few possible causes. Try creating a simple test.php file in the subdirectory in question, like this:
Code:
Text Test
<?php="PHP Test" ?>
Start by accessing the test file directly. If you don't get the PHP Test text when accessing the file directly, the problem is with executing php in the subdirectory; if you don't get any text at all, the problem is with the server dealing with files in the subdirectory (permissions maybe).
If everything works when accessing the file directly, check the SSI. If you get the PHP Test portion, the problem is with the script you were trying to use, some ini configuration setting has changed and broken the script, possibly a change in how some environmental variable is handled. If you only get the Text Test, the problem is probably in the PHP.ini file, and the resolution will depend on how your server interacts with the PHP interpreter. If you don't get anything with the SSI, it is a problem with the way your server handles subdirectories... check if there is or should be a leading slash, and check the config.
Unfortunately cant really tell you anything specific, but this should help you narrow down the source of the problem.
Reply With Quote
  #3 (permalink)  
Old 09-19-2006, 02:26 AM
Orion's Avatar
WebProWorld Veteran
 

Join Date: Sep 2003
Location: Halton Hills, ON
Posts: 595
Orion RepRank 2
Default

I have more info...

php works fine btw... over 120 sites all working about 50% have at least some php on them.

ok get this..

SSI works fine...

If I include virtual the .php file in the .shtml and the php file is located in the same directory as the .shtml .. IT WORKS

If I move the .php into a sub directory (where they all are) IT DOESN"T WORK

If I change my include to file and the .php is in the sub directory IT WORKS (that shouldn't I know).

So where? what? are the settings in httpd.conf or php.ini (or are they elsewhere php 5 bugfix?) to be able to allow the includes virtual to work in subdirectories when dealing with .php files..

OR

what is it we have as a setting that could be screwing it up?
__________________
Ron Boyd
Web design & site management :: Ron's blog
Reply With Quote
  #4 (permalink)  
Old 09-19-2006, 10:47 AM
wige's Avatar
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,840
wige RepRank 4wige RepRank 4wige RepRank 4wige RepRank 4
Default

What server are you using? If it is Apache, have you gone through the server's error log to see if it is giving an error message? (usually /var/log/httpd/errorlog)

Also, is there plain text output in the file you are including are is all of the output contained in php tags? There are a few possible issues... the server may not be finding the file, the server may not be able to access the file (php added a "safe mode" that attempts to prevent unauthorized access to certain things, including if one directory has different permissions or a different owner than another) or the server may simply not be sending the file to the PHP interpreter.

The best way to narrow down these possibilities is to check the server log for any messages, and see if non-php output is being rendered. Also check what method you are using to execute PHP scripts. Probably not part of the issue, but may be relevant.
Reply With Quote
  #5 (permalink)  
Old 09-19-2006, 03:47 PM
Orion's Avatar
WebProWorld Veteran
 

Join Date: Sep 2003
Location: Halton Hills, ON
Posts: 595
Orion RepRank 2
Default

[Mon Sep 18 02:19:39 2006] [error] [client 69.157.226.6] Directory index forbidden by rule: /var/www/vhosts/herbacentral.com/httpdocs/

that's the only error we get...

-safemode is off
-yes it's apache / php5 all through plesk 8.0.1
-we uploaded the entire site using one ftp user name.. and before that we chown the entire httpdocs dir and all files / folders in it to reset just in case

all the included files are .php with php code in them
we can include them no problem using
Code:
<!#include file="/includes/file.php">
or
Code:
<!#include virtual="/file.php">
however if you use
Code:
<!#include virtual="/includes/file.php">
it doesn't work.


So it's something to do with the virtual directive being unable to include a file in a subdirectory if that file has a .php extension (works fine for all other extensions).

anyone????
__________________
Ron Boyd
Web design & site management :: Ron's blog
Reply With Quote
  #6 (permalink)  
Old 09-21-2006, 03:16 PM
wige's Avatar
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,840
wige RepRank 4wige RepRank 4wige RepRank 4wige RepRank 4
Default

From what I understand, PHP5 has added additional security checks to prevent the PHP script from accessing files that would not otherwise be accessible from the web server. From the error message that you indicated, the PHP processor may be trying to verify that the server has access to the PHP script before executing it.

Unfortunately I am not sure how to confirm that this is the problem or how to do a workaround.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , , , , , ,



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

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


Search Engine Optimization by vBSEO 3.2.0