PHP include path

They have: 334 posts

Joined: Dec 1999

Does anyone know the proper syntax for editing the .htaccess file to force PHP to use includes from a different directory?

I'd like to set up a folder to handle all my inluded files in a central location rather than storing them with the .php files. So under my root directory I'd like to have a folder named "includes" that will serve all sub-directories.

I've tried editing the .htaccess file to include lines like:
php3_include_path "/home/username/public_html/includes"
php3_include_path "/home/username/public_html/includes/"
php3_include_path "home/username/public_html/includes"

etc etc with varying syntax on the quotes and slashes, but the includes never appear on the page. Yes, I've checked to make sure that the include files are in the right directory and are referenced correctly in the .php file, so it's not something that simple.

BTW, I have this working fine on my home machine by changing the include path in the php3.ini file, but I just can't make it work on the remote server. Any help would be appreciated.

They have: 5,633 posts

Joined: Jan 1970

php3_include_path ".:/home/username/public_html/includes/"

I am not positive why the .: is needed, but it is.

------------------
Dynamic Internet Solutions : http://www.dids.com
Windows NT and UNIX Hosting

They have: 334 posts

Joined: Dec 1999

Thanks Chad. Figured it out ages ago, but I appreciate the reply. Turns out it wasn't working because .php files were not getting parsed, only files names .php3 were working. BTW, the .:/ isn't needed.

php3_include_path "/home/username/public_html/includes/" works just fine without it.

They have: 5,633 posts

Joined: Jan 1970

Maverick,

I kind of figured you had probably figured it out before now or you would have contacted us.

Not sure if you were trying this on our server, but .php does parse as a PHP file on our servers...

Looks like I need to brush up on what I know about PHP ... I just took the line from php.net and figured it must be needed for something... Eventually, I will actually start reading that stuff so that I know what, if anything, it is really needed for

------------------
Dynamic Internet Solutions : http://www.dids.com
Windows NT and UNIX Hosting

[This message has been edited by Chad Simper (edited 22 January 2000).]

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.