require_once ??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
venadder
Forum Newbie
Posts: 4
Joined: Sun Nov 05, 2006 3:07 pm

require_once ??

Post by venadder »

Jcart | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hi,
I am new to PHP and have this weird problem. using a config.php file to set some basic defines in the project. It works throuout except in one case and I have tried to find what's goign on but havn't been able to figure out.

Code: Select all

//file config. php folder: webroot/lib/base
<?php
define( "TEST_CONFIG", '1' );
?>
file: example.php folder: webroot/lib/classes

Code: Select all

<?php

require_once( 'lib/base/config.php' );

if( defined( 'TEST_CONFIG' ) )
    echo 'works';
else
   echo 'oops';
?>
somehow the test always fails and I always get oops???

can some one help me with a few hints, please?

thnak you


Jcart | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

hint: turn php errors on
venadder
Forum Newbie
Posts: 4
Joined: Sun Nov 05, 2006 3:07 pm

Post by venadder »

It was actually puling a different config file.

The problem was related to include path environment variable.

Thanx for help
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

:wink:
Post Reply