.htaccess Issues With Macports Apache Install

Ryan Schmidt ryandesign at macports.org
Fri Aug 28 00:08:52 PDT 2009


Hi Steve! Here's some help for your first question; I'll tackle your  
second question in the next email.


On Aug 28, 2009, at 01:09, Steve Edwards wrote:

> On my MacBook Pro, I installed Apache/MySQL/PHP using MacPorts. I'm  
> running PHP 5.2.9 and Apache 2.2.11.  It works great, except for a  
> couple things.  For some reason, the .htaccess file cannot have the  
> following lines in it:
>
> # PHP 5, Apache 1 and 2.
> <IfModule mod_php5.c>
>   php_value magic_quotes_gpc                0
>   php_value register_globals                0
>   php_value session.auto_start              0
>   php_value mbstring.http_input             pass
>   php_value mbstring.http_output            pass
>   php_value mbstring.encoding_translation   0
> </IfModule>
>
> When they are, I get the following error message in my Apache error  
> log:
>
>  /Users/steve/Sites/myartleague/.htaccess: php_value not allowed here
>
> However, if I comment them out and put them in httpd.conf, I don't  
> get the error.  However, this is a pain, since I have to modify  
> the .htaccess any time it's updated.
>
> What's odd is that I have AllowOverride All set in httpd.conf.  You  
> can see it at http://pastebin.com/m4e09f963.

True, the AllowOverride All you have in your <Directory "/Users/steve/ 
Sites"> block is all you need. But this line is undoing it:

Include conf/extra/httpd-userdir.conf

In httpd-userdir.conf, you'll see the line:

AllowOverride FileInfo AuthConfig Limit Indexes

I tried that line on my system and was able to reproduce your  
problem. So you can either change the AllowOverride in httpd- 
userdir.conf to All, or just don't use httpd-userdir.conf and  
mod_userdir at all. On my MacBook Pro, I'm the only user and the only  
one whose home directory should be served, so I turn off mod_userdir  
and don't include httpd-userdir.conf; instead, I just add this to my  
httpd.conf:


# Enable just rschmidt's home directory.
<Directory /Users/rschmidt/Sites>
     Options FollowSymLinks
     AllowOverride All
     Order allow,deny
     Allow from all
</Directory>
Alias /~rschmidt /Users/rschmidt/Sites


Note also in the Apache documentation:

http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

"For security and performance reasons, do not set AllowOverride to  
anything other than None in your <Directory /> block."

You have currently set AllowOverride to All in your <Directory /> block.




More information about the macports-users mailing list