PDA

View Full Version : <?php Include problem



Sniper Jo
March 30th, 2006, 12:22 PM
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

cheers,

theflashdude
March 30th, 2006, 12:45 PM
Try and edit your 'php.ini' file and upload it to your FTP server. Try to insert:
register_global = on;

Hope it helps

ironikart
March 30th, 2006, 04:39 PM
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.

hl
March 30th, 2006, 11:21 PM
Try and edit your 'php.ini' file and upload it to your FTP server. Try to insert:
register_global = on;

Hope it helps
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.

Ankou
March 31st, 2006, 02:21 AM
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

cheers,

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:
include_path=".;F:\PHP\pear"

My Linux include_path looks like so:
include_path=".:/php5/includes"

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

Sniper Jo
March 31st, 2006, 02:33 PM
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!