vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   including global.php from different directory? (https://vborg.vbsupport.ru/showthread.php?t=252460)

Jinovich 10-22-2010 11:46 PM

including global.php from different directory?
 
Okay so I can include global.php from / where it exists like so.

/functions.php
PHP Code:

include('./global.php'); 

Its fine with that.

/custompages/foobar/functions.php
However it seems to hate it when I include it as
PHP Code:

include('../../global.php');
include(
'/home/base/public_html/global.php'

hates that errors out with:


Warning: require(./includes/class_bootstrap.php) [function.require]: failed to open stream: No such file or directory in /home/base/public_html/global.php on line 15

Fatal error: require() [function.require]: Failed opening required './includes/class_bootstrap.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/base/public_html/global.php on line 15

assuming that it is trying to look for these files from /custompages/foobar/instead of /.

How can I fix this,

I want to include global so I dont need to set up the mysql db connections.

sacobra 08-02-2011 05:05 PM

Anyone can help with the above query?

I'm attempting to create a product and am planning to have all the files in packages/<product> rather than spread throughout the folders. However it seems to be difficult to include 'global.php' in the files !

kh99 08-02-2011 05:11 PM

I think it will work if you chdir() to the directory with global in it. You can chdir() back after it's included. Like (using the example above):

PHP Code:

$savedir getcwd();
chdir('/home/base/public_html')  
include(
'global.php');
chdir($savdir); 



All times are GMT. The time now is 08:29 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01130 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete