include_path in php.ini on local server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wmike1503
Forum Newbie
Posts: 3
Joined: Sun Jan 15, 2012 12:36 pm

include_path in php.ini on local server

Post by wmike1503 »

Hi,

I am trying to set a new include_path. My site is on a local server with various sub-directories for different web projects.

I have a php tutorial site in the following share on a QNAP server - qweb/phplearning. I want to add this directory to the include_path. I'm struggling with the correct syntax to use.

Any help gratefully received. Sorry if this is a bit basic.

Cheers,

Mike
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: include_path in php.ini on local server

Post by Christopher »

If you want to set it in php.ini then look here: http://us2.php.net/manual/en/ini.core.p ... clude-path

If you want to set it in the script then look here: http://us2.php.net/manual/en/function.s ... e-path.php
(#10850)
wmike1503
Forum Newbie
Posts: 3
Joined: Sun Jan 15, 2012 12:36 pm

Re: include_path in php.ini on local server

Post by wmike1503 »

Hi Christopher,

Thanks for that.

Yes, I've already looked at those links. My problem is the syntax - I've tried various forms, .:/qweb/phplearning , .:/localhost/phplearning, .:ip/phplearning. None of them seem to work. I am, obviously not getting the correct syntax. That is my question - what am I doing wrong. I am sure it is a simple mistake. I understand that you seperate each folder with :

Cheers,

Mike
User avatar
Tiancris
Forum Commoner
Posts: 39
Joined: Sun Jan 08, 2012 9:54 pm
Location: Mar del Plata, Argentina

Re: include_path in php.ini on local server

Post by Tiancris »

The separator character depends on the server operating system:
- Linux uses ":".
- Windows uses ";".
It is better to use the PHP constant PATH_SEPARATOR.
wmike1503
Forum Newbie
Posts: 3
Joined: Sun Jan 15, 2012 12:36 pm

Re: include_path in php.ini on local server

Post by wmike1503 »

Hi,

Thanks for that, yep I understand that - on Linux. Path_Seperator - getting more confused :).

I simply wish to understand the correct syntax for point the path to the local hosted directory as described above.

Cheers,

Mike
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: include_path in php.ini on local server

Post by Christopher »

You absolute path may be something like "/home/qweb/phplearning". If you can login to a shell in that computer, "cd" to that directory and then run the command "pwd" to show the current absolute path.
(#10850)
Post Reply