View Full Version : Help on PHP includes
slideboxer
12-24-2001, 05:48 AM
I'm trying to add some PHP includes to my sites home non-vB page. I'm not too familiar witht his stuff but I follow directions well :D Anyway, I'm using <? include("vbforums/filename.php"); ?> to read the info but I keep getting the following error:
Fatal error: Failed opening required './admin/config.php' (include_path='.:/usr/local/lib/php') in /home/www/mysite/vbforums/global.php on line 96
I've received this error on several different hacks I've attempted. What can i do to remedy this?
JamesUS
12-24-2001, 08:11 AM
Try this (no idea if it will work but worth a try):
chroot("/home/www/mysite/vbforums/");
require("./global.php");
chroot("/home/www/mysite/");
slideboxer
12-26-2001, 03:55 AM
I found I needed to use the chdir command. Oddly I'm having to use it with each and evry include on the page, not sure if that's the way ti's supposed to be ot not, but, it's all working. Thanks for the reply.
Mark Hensler
12-26-2001, 08:38 PM
Easiest way is to just alter your include_path (http://www.php.net/manual/en/configuration.php#ini.include-path). There are two way you can do this...
Via .htaccess:
php_value include_path .:/home/www/mysite/vbforums:/home/www/mysite/php-includes
Via PHP:
ini_set("include_path", ini_get("include_path") . ":/home/www/mysite/vbforums:/home/www/mysite/php-includes");
I prefer using .htaccess because I can put it in my root web directory and the changes are global. It's a lot easier to edit one file than many.
PHP Docs: ini_set() (http://www.php.net/manual/en/function.ini-set.php), ini_get() (http://www.php.net/manual/en/function.ini-get.php)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.