<?php Include problem

Hi guys,

Now i normally use this metod but at the moment i am using my mac as a server so i am using MAMP. The problem is , i have a main file (index.php) that includes config.php and list.php. When i view the page it says that the varibles in config.php dont exist in list.php. Is there some kind of option in php.ini that might be doing this?

note: i have also tried require and no errors are displayed


Try and edit your ‘php.ini’ file and upload it to your FTP server. Try to insert:

register_global = on;

Hope it helps

Don’t enable register globals - there’s absolutely no need for it. Your problem lies elsewhere. It’s probably not a php.ini setting, assuming you’ve left it at php defaults. I’d be starting with directory permissions… make sure you have the appropriate user + permissions set. It may be surpressing the errors trying to include the file.

Set your error level to the most verbose (E_ALL), that should pick up anything it’s missing.

Actually, I’m kind of assuming with the above advice, that your files aren’t including correctly.

That has just about NOTHING to do with this situation, be sure to read the post fully and not react just on a few words.

Sniper Jo, could you by chance post the code you’re working with? It might help more in finding a solution. With the information you posted it could be a number of things and seeing the code you’re using may help us out more.

I would assume, like ironikart said, that’s it’s probably not a php.ini problem if you left the default settings alone, but just incase open your php.ini file and have a look for your “include_path”. Make sure that the include_path is set to work for relative includes. Meaning it should have a dot ( . ) as part of the path.

I’m not on a Mac but my include_path in my Windows php.ini file looks like so:

**My Linux include_path looks like so:

Notice the . before the ; (on windows) and the : (on linux). That makes sure that you’re allowing relative includes.

thanks guys, my bad i created a funtion to include the file and that was causing the data in config.php to not be related. Thanks anyhoo!