Jump to content

Require_Once() Not Working?


tgavin

Recommended Posts

I'm encountering a weird one on IIS with PHP 5.4.7

 

in my script I'm trying to include my config.php file (located in the same directory), so I put require_once('config.php'); as I normally would on Linux.

 

Well, later in my script I'm getting an undefined variable notice, even though the var has been defined in config.php. So I open config.php and do this

 

$base_dir = 'www';

var_dump($base_dir);

exit;

 

now, not only do I now see a result from the var_dump, the script doesn't die as it should, and I continue receiving the undefined variable notice at the same point in the script. WTH?

 

Even if I do

 

require_once('config.php);

var_dump($base_dir);

exit;

 

I get no results - just the undefined var error. it's almost like the config.php file isn't being included. Any ideas?

Link to comment
Share on other sites

PFMaBiSmAd: Excellent catch! I'm implementing a system that a previous developer had created and he's using bullcrap shortcuts all over the place. Very lazy and insecure.

 

That fixed it, thank you! :)

Edited by tgavin
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.