index.php files ignored

Ryan Schmidt ryandesign at
Tue Mar 22 08:34:45 PDT 2011

On Mar 22, 2011, at 10:05, Tony Miller wrote:

> After spending the weekend reading, and poking through the various logs, I came up with a possible solution. In the default httpd.conf file there is the following block:
> # First, we configure the "default" to be a very restrictive set of 
> # features.  
> #
> <Directory />
>    Options FollowSymLinks
>    AllowOverride None
>    Order deny,allow
>    Deny from all
> </Directory>
> # I added this block to see if that is what was restricting the files
> <Directory /opt/local/apache2/htdocs>
>    Order Allow,Deny
>    Allow from all
> </Directory>
> The default was choked down and there was no subsequent allowance for the directory I needed apache to have access to? Does that make sense to you? 

According to /opt/local/apache2/conf/original/httpd.conf, there should be a block denying access to everything:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all

And then a block granting access to the htdocs directory (it has lots of comments, which I've removed here for brevity):

<Directory "/opt/local/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all

If you have multiple vhosts and some document roots outside of this /opt/local/apache2/htdocs directory, then you should copy and paste that allowance block for each such directory.

> When I started putting back pieces to see if I could isolate the problem, I also discovered that putting the DirectoryIndex block outside the Directory block in the VirtualHost caused me to get the permission error again. This block seems to work:
>    <Directory "/opt/local/apache2/htdocs/leopoldheritage">
>        AllowOverride None
> 	<IfModule mod_dav.c>
> 		DAV Off
> 	</IfModule>
> 		Options All -Includes -ExecCGI +MultiViews -Indexes
> 	<IfModule dir_module>
>    		DirectoryIndex index.php index.html
>        </IfModule>
>    </Directory>
> In the problem conf, the <IfModule dir_module> block was under the </Directory> line. Moving it inside the directory block seems to work.

I can't advise here; this becomes an Apache question better suited for an Apache mailing list or other support forum. If you found a config that works for you, then I'm pleased, and you can probably leave it that way.

> Finally, while working with MacPorts, it began telling me the install was two weeks old and I should run selfupdate, so I did. Now the php files are serving as I would expect and php 5.3.6 is installed, but the php files can no longer connect to MySQL.

Just to be clear, "sudo port selfupdate" updates MacPorts base and your port definitions. It will not actually update any installed ports. If your ports got updated, then you must've also run "sudo port upgrade outdated" or similar.

> From the logs it looks like the update has removed a file and the server is unable to start:
> 110321 22:47:28 mysqld_safe Starting mysqld daemon with databases from /opt/local/var/db/mysql5
> 110321 22:47:28 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
> 110321 22:47:28 [Warning] The --skip-thread-priority startup option is deprecated and will be removed in MySQL 7.0. MySQL 6.0 and up do not give threads different priorities.
> 110321 22:47:28 [Warning] Setting lower_case_table_names=2 because file system for /opt/local/var/db/mysql5/ is case insensitive
> /opt/local/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
> 110321 22:47:28 [ERROR] Aborting

Have you made other changes in your my.cnf? Googling this "mysql-bin.index not found" error suggests that perhaps your datadir is not set correctly in my.cnf, or that your data directory does not have the correct permissions or ownership.

> My question is will doing a port clean install php5-mysql remove the databases? I can restore from backups if so.

It certainly shouldn't. Uninstalling or upgrading a port should not affect databases or other files created using that port. (Some ports are not entirely compliant with this, in that MacPorts might overwrite changes you've made in their config files when you upgrade; if you find such a port, file a bug report so we can fix it.)

> Is there an easier way to just redo the mysql and leave php intact?

You can rebuild your mysql5 port by using:

sudo port -n upgrade --force mysql5

However, so far, I see no reason to suggest you do so; as far as I can tell, your mysql5 is installed perfectly fine already.

> Finally, is the warning about the file system being case sensitive an issue and could it be causing my missing file woes? Should I reformat and restore to a case insensitive file system?

Re-read the warning: it says your filesystem is case-INsensitive (as is the usual for Mac OS X). You should not reformat to case-sensitive, unless you have unrelated and very good reasons for doing so. The warning says that because the filesystem is case-insensitive, it is using the setting lower_case_table_names=2, even though you did not set it in your my.cnf. This is not a problem; this is the normal way MySQL works on Mac OS X. If you want to avoid the warning, set lower_case_table_names=2 in your my.cnf.

More information about the macports-users mailing list