Forum Moderators: phranque

Message Too Old, No Replies

php_include paths

Moving from Apache to Apache

         

jmll

1:28 pm on Jul 23, 2004 (gmt 0)

10+ Year Member



Hello,
I've moved from one host where the include path was this: /data/www/e/r/r-editions.com/php-include:./ and the default config provided a php-include directory above web-root (same level as public_html) for headers, footers and other recurring files which I could call with <?php
include ("hdr.html");?>.
Now at my new host's the include path is this: .:/usr/lib/php:/usr/local/lib/php and there is a cgi bin folder under public_html. I tried an .htaccess with this line: php_value include_path ".:/usr/www/erredit/includes" (I created an 'includes' directory above root) and other paths with no success at all except a 500 internal server error. Can anyone help please? jmll

coopster

2:09 pm on Jul 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, jmll!

Most shared servers I have worked on have the *www* directory as the public area, or root of the public area. Are you sure the path here is correct?

".:/usr/www/erredit/includes" (I created an 'includes' directory above root)

jmll

2:52 pm on Jul 23, 2004 (gmt 0)

10+ Year Member



Hi Coopster,
You ask me:
>Are you sure the path here is correct?

>".:/usr/www/erredit/includes"

I'm sure it is wrong since its brings me a 500 error everytime.
After reading you I tried this:
".:/usr/www/includes"
Same result.

coopster

3:00 pm on Jul 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Here nor there, I just entered an invalid path/directory and it was accepted just fine, so that shoots the invalid path/directory theory. That said, the syntax is just fine. What else is in the .htaccess file?

jmll

3:29 pm on Jul 23, 2004 (gmt 0)

10+ Year Member



Here is the horrible .ht:
DirectoryIndex index.html
Options -Indexes
AddType application/x-httpd-php .html .php
ErrorDocument 401 /errorbot.php3?error=401
ErrorDocument 403 /errorbot.php3?error=403
ErrorDocument 404 /errorbot.php3?error=404
ErrorDocument 500 /errorbot.php3?error=500
<Files ~ "^\.ht">
order allow,deny
deny from all
</Files>
php_value include_path ".:/usr/www/includes"
#include($_SERVER["DOCUMENT_ROOT"] . "/includes");
ExpiresActive on
ExpiresDefault "access plus 10 seconds"
ExpiresByType text/html "modification plus 10 seconds"
ExpiresByType image/jpg "modification plus 10 seconds"
ExpiresByType text/css "modification plus 10 seconds"
#ExpiresByType text/javascript "modification plus 10 seconds"
#ExpiresByType text/php3 "modification plus 10 seconds"

I don't see what could cause the server error in it (it worked fine with previous host)
#include($_SERVER["DOCUMENT_ROOT"] . "/includes"); being a not yet erased trial for the same problem.

coopster

3:52 pm on Jul 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It has nothing to do with your include directive, it is more than likely the mod_expires [httpd.apache.org] module (or probably lack thereof). You see, this is an extension module and your host probably doesn't have it compiled.

Comment out all your Expires* directives and give your PHP a whirl, I'm betting it works.

jmll

4:14 pm on Jul 23, 2004 (gmt 0)

10+ Year Member



I did that and no more 500; instead I get this:
Warning: main(hdr.html): failed to open stream: No such file or directory in /home/erredit/public_html/index.html on line 27

Warning: main(): Failed opening 'hdr.html' for inclusion (include_path='.:/usr/www/includes') in /home/erredit/public_html/index.html on line 27

coopster

4:34 pm on Jul 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



OK, now your include path is incorrect. Either that or the included file is not in that directory.

jmll

4:49 pm on Jul 23, 2004 (gmt 0)

10+ Year Member



The file is in the directory: I checked before previous post and there is no extension (htm/html) error. The include path is wrong: that's right. Anyhow thanks for so many fast replies.

jmll

7:39 am on Jul 24, 2004 (gmt 0)

10+ Year Member



And now, the solution, should anyone be interested:
php_value include_path .:../:./include:../includes
Rather mysterious but it works.

jdMorgan

1:56 pm on Jul 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



jmll,

Since your new server apparently does not have mod_expires installed, you will probably need to implement cache control using php's header() function. Otherwise, your users may see stale content. This may or may not be an issue, depending on how "dynamic" your pages are. But without mod_expires, you are leaving the caching decisions to the network, ISP, and user browser caches.

Jim

jmll

6:55 am on Jul 25, 2004 (gmt 0)

10+ Year Member



Hi Jim,
I've checked phpinfo and mod_expire is not loaded as Coopster had rightly guessed; mod_headers isn't either. Since I'm planning to switch to some or other CMS I thought php would take care of caching: am I right or should I start hassling my host?
Two posts ago I thought I had solved my include path problem: not quite so!
The line (php_value include_path .:../:./include:../includes ) works fine when I call my includes from root (domain.tld/file.html); if they are called from a subfolder (domain.tld/folder/file.html) I get the classical :Warning: main(enhdr.html): failed to open stream: No such file or directory in /home/erredit/public_html/english/entrad.html on line 25...
The include mystery_path!
Have a good day jm