PDA

View Full Version : How do I run a php script from /root instead of forum/root without errors?


Fibe
01-24-2005, 02:03 PM
Example I moved this random hack to the website root instead of the domain root and get this error:


Warning: main(./global.php): failed to open stream: No such file or directory in /home/xxx/public_html/members.php on line 81

Fatal error: main(): Failed opening required './global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxx/public_html/members.php on line 81


I fixed this by simply changing:

// ######################### REQUIRE BACK-END ############################

require_once('./global.php');


To:

// ######################### REQUIRE BACK-END ############################

require_once('./forums/global.php');


But now I get the following error where I no longer have any clue how to make it work:

Warning: main(./includes/init.php): failed to open stream: No such file or directory in /home/xxx/public_html/forums/global.php on line 53

Fatal error: main(): Failed opening required './includes/init.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxx/public_html/forums/global.php on line 53


Anyone able to assist me with this problem?

Thanks !

Marco van Herwaarden
01-24-2005, 02:08 PM
Well i don't really understand why you want your hacks to be placed outside the forum root, that is asking for problems.

One way f solving this could be by changing directory to the forum root, just before you call any vB scripts.

Fibe
01-24-2005, 02:20 PM
They are hacks that use the forum database but are shown on seperate page.
Only reason I want to move them is because they are links on main page of website where everything is www.domain.com/script.php except 2 of them and looks nicer if all of them are in same directory.

Zachery
01-24-2005, 02:27 PM
They are hacks that use the forum database but are shown on seperate page.
Only reason I want to move them is because they are links on main page of website where everything is www.domain.com/script.php except 2 of them and looks nicer if all of them are in same directory.
Its not that hard at all, before the call to global.php add

chdir('./forums');

Fibe
01-24-2005, 02:48 PM
....
thats simple hahaha

Thanks Zachery !