Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 7th, 2003, 05:00 PM
Registered User
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default .htaccess file in root folder

Hi, hope you can help.

I'm using Apache running on W2K. Love PHP but....

My root folder is htdocs - I'm trying to set up an .htaccess file as described in PHP MySQL Website programming p28 - having no luck. I wrote php_value include_path ".:htdocs/_lib/_base etc" in Notepad and saved it in my root directory, but it isn't taking effect. I also wrote php_value register_globals "Off" (globals were on as I checked using phpinfo() ) and still had no joy.

When I run a program that includes or requires "elements.php" (for example) I'm getting an error message - obviously the file path isn't right.

Any pointers?

Many thanks,

Old September 8th, 2003, 02:39 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

Well, the htdocs/_lib/_base is a relative path, not an absolute one... that means that the path is interpreted differently depending on where the .htaccess file is located.

Your best bet is to always use absolute paths when specifying your include paths. You can always double check your settings using phpinfo().

When you configure PHP using php.ini or httpd.conf, your settings become the "master value". When you override those changes in .htaccess files, those become the "local value".

The last thing you need to do is configure Apache to allow configuration changes in .htaccess files. You need to enable the Options override for the directories you want to modify php config changes in.

Search the Apache manual for the AllowOverride directive. You need to have "AllowOverride Options" set for your directory.

Take care,


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to play mp3 file stored outside root folder nocturn ASP.NET 2.0 Professional 0 October 26th, 2006 10:31 AM
Rename File/Folder shivanshub General .NET 0 August 11th, 2006 01:57 PM
changing root path in file manager codergirl BOOK: ASP.NET Website Programming Problem-Design-Solution 3 November 11th, 2004 04:21 PM
Can't Run JSTL Outside of Root Folder incogito73 JSP Basics 1 October 13th, 2004 07:06 PM
.htaccess file ruhin Beginning PHP 3 June 23rd, 2004 09:31 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.