Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/60808-solved-phpini/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-302522
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-302561
Share on other sites

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"   ;

;

Link to comment
https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-302575
Share on other sites

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')

Link to comment
https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-302608
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-302798
Share on other sites

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]

Link to comment
https://forums.phpfreaks.com/topic/60808-solved-phpini/#findComment-303548
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.