flowingwindrider Posted July 19, 2007 Share Posted July 19, 2007 I having trouble configuring include_path in my php.ini file. I've created a directory named admin/includes and I thought that I had pointed the ini file to it, but it doesn't seem to work. That section of my php.ini file looks like: Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" include_path = ".:/admin/includes" ; ; ; Windows: "\path1;\path2" include_path = ".:\admin\includes" ; ; Thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/60808-solved-phpini/ Share on other sites More sharing options...
trq Posted July 19, 2007 Share Posted July 19, 2007 Is this windows or Linux? You have both lines uncommented, pick one and only one. if admin/includes is in your systems root directory (Linux) your path would look like... include_path = ".:/admin/includes"; PS: There should be more in your path already by default. Did you remove anything? Quote Link to comment https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-302522 Share on other sites More sharing options...
thedarkwinter Posted July 19, 2007 Share Posted July 19, 2007 a couple of thoughts 1. what permissions does /admin/includes have? try chmod 666 it (maybe evern 777) 2. did you restart apache (or webserver) after adding that line? [edit] still posting even though the other post came in the mean time Quote Link to comment https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-302523 Share on other sites More sharing options...
flowingwindrider Posted July 19, 2007 Author Share Posted July 19, 2007 The include-path section of the php.ini file that my web host gave me looks like this: Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" include_path = ".:/usr/lib/php:/usr/local/lib/php" ; ; ; Windows: "\path1;\path2" include_path = ".:/usr/lib/php:/usr/local/lib/php" ; ; It's a linux server, so why is there windows info included? Do I just delete out the windows parts? Quote Link to comment https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-302561 Share on other sites More sharing options...
trq Posted July 19, 2007 Share Posted July 19, 2007 It's a linux server, so why is there windows info included? The ini file is the same for both... some attributes have different examples for both. Your file should look like... Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" include_path = ".:/usr/lib/php:/usr/local/lib/php:/admin/includes" ; ; ; Windows: "\path1;\path2" ;include_path = ".:/usr/lib/php:/usr/local/lib/php" ; ; Of course, this assumes that admin/includes is within your systems root directory. If its in your home directory it might look something like... Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/username/admin/includes" ; ; ; Windows: "\path1;\path2" ;include_path = ".:/usr/lib/php:/usr/local/lib/php" ; ; Quote Link to comment https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-302575 Share on other sites More sharing options...
flowingwindrider Posted July 19, 2007 Author Share Posted July 19, 2007 I remain confused. I've entered the code just as you've listed it. I've set the file permissions. /admin/includes is in the root directory, not my public_html directory. It still doesn't function. The error being returned is: Warning: include() [function.include]: Failed opening 'var.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/admin/includes') Quote Link to comment https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-302608 Share on other sites More sharing options...
flowingwindrider Posted July 19, 2007 Author Share Posted July 19, 2007 Alright, let me kinda start this over. I was wrong before, I'm running on a windows platform, not linux. I would like the include_path to lead to 'admin/includes'. My php.ini that I got from my hosting company looked like this at first: Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" include_path = ".:/usr/lib/php:/usr/local/lib/php" ; ; ; Windows: "\path1;\path2" include_path = ".:/usr/lib/php:/usr/local/lib/php" ; ; I have modified it to look like this: Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" include_path = ".:/usr/lib/php:/usr/local/lib/php" ; ; ; Windows: "\path1;\path2" include_path = ".;c:\usr\lib\php;\usr\local\lib\php;\admin\includes" ; 1)Should I completely get rid of the linux section? 2)Every example I can find online has the c: in it, but how do I know if that is truly the drive letter on my server? I have run phpinfo() and it seems to be listing the include_path the way the examples show it should work, and I have set the permissions to 777. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-302798 Share on other sites More sharing options...
wildteen88 Posted July 20, 2007 Share Posted July 20, 2007 Why do you want to add admin/includes to the include_path. How come you can't use: include './admin/includes/somefile.php'; if admin/includes is outside of the folder the running script is in then you can use ../ to go up a level in the directory tree. For example say your directory tree is like this: someFolder | +- folderA | | | +--- fileA.php | +- folderB | +--- fileB.php Say you are currently running the script fileA.php but you need to include fileB.php but it is folderB and not folderA. In order to include fileB.php you need to tell PHP to go out side of the current working directory (which is folderA) and to go one level higher in the directory tree (which is someFolder) then to go into FolderB to include fileB.php you do this by adding ../ at the start of the path, eg: include '../folderB/fileB.php'; You can use ../ as many times as you want within the path. Everytime you use ../ PHP goes one level higher in the directory tree.[/code] Quote Link to comment https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-303548 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.