# \<?php Include problem

**URL:** <https://forum.kirupa.com/t/php-include-problem/183844>\
**Category:** programming\
**Created:** [March 30, 2006, 5:22pm UTC](https://forum.kirupa.com/t/php-include-problem/183844 "2006-03-30T17:22:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sniper\_Jo](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@Sniper\_Jo](https://forum.kirupa.com/u/Sniper_Jo)\
**Post date:** [March 30, 2006, 5:22pm UTC](https://forum.kirupa.com/t/php-include-problem/183844/1 "2006-03-30T17:22:40Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![theflashdude](https://avatars.discourse-cdn.com/v4/letter/t/e274bd/32.png) [@theflashdude](https://forum.kirupa.com/u/theflashdude)\
**Post date:** [March 30, 2006, 5:45pm UTC](https://forum.kirupa.com/t/php-include-problem/183844/2 "2006-03-30T17:45:08Z")

</div>

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

```auto
register_global = on;

```

Hope it helps

---

<div class="post-metadata">

**Author:** ![ironikart](https://avatars.discourse-cdn.com/v4/letter/i/7feea3/32.png) [@ironikart](https://forum.kirupa.com/u/ironikart)\
**Post date:** [March 30, 2006, 9:39pm UTC](https://forum.kirupa.com/t/php-include-problem/183844/3 "2006-03-30T21:39:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hl1](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hl1/32/849_2.png) [@hl1](https://forum.kirupa.com/u/hl1)\
**Post date:** [March 31, 2006, 4:21am UTC](https://forum.kirupa.com/t/php-include-problem/183844/4 "2006-03-31T04:21:30Z")

</div>

> [@theflashdude](#):
>
> Try and edit your ‘php.ini’ file and upload it to your FTP server. Try to insert:
> 
> ```auto
> 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.

---

<div class="post-metadata">

**Author:** ![Ankou](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ankou/32/1351_2.png) [@Ankou](https://forum.kirupa.com/u/Ankou)\
**Post date:** [March 31, 2006, 7:21am UTC](https://forum.kirupa.com/t/php-include-problem/183844/5 "2006-03-31T07:21:03Z")

</div>

> [@Sniper Jo](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Sniper\_Jo](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@Sniper\_Jo](https://forum.kirupa.com/u/Sniper_Jo)\
**Post date:** [March 31, 2006, 7:33pm UTC](https://forum.kirupa.com/t/php-include-problem/183844/6 "2006-03-31T19:33:35Z")

</div>

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!
