Search code examples
phpapachezend-frameworkphpmyadminopensuse

Apache virtual host configuration: How to make my Zend projects and phpMyAdmin play together?


In order for me to be able to run a Zend Framework project on my local development machine, I made changes to Apache's \etc\apache2\httpd.conf and the openSUSE system's \etc\hosts files. I set up a test3.local alias for an individual Zend project, and things seem to "work".

Before I started fiddling with things, I could access phpMyAdmin simply by entering http://localhost/phpMyAdmin/ in my browser. And if I take away my changes, that once again works.

Using this answer as a basis, I tried to set up an additional virtual host specifically for phpMyAdmin, hoping to "solve" this problem. But right now if key in the virtual host name, admin.local, that I intend to take me to phpMyAdmin, I get a 403 error like this: 403 error
(source: willmatheson.com)

Here is my present httpd.conf:

### Virtual server configuration ############################################
IncludeOptional /etc/apache2/vhosts.d/*.conf

<VirtualHost *:80>
    ServerName test3.local
    DocumentRoot /home/william/public_html/ZendTest3/public

    SetEnv APPLICATION_ENV "development"

    <Directory /home/william/public_html/ZendTest3/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName admin.local
    DocumentRoot /var/lib/mysql/phpMyAdmin

        # This gives permission to serve the directory
        <Directory /var/lib/mysql/phpMyAdmin>
            DirectoryIndex  index.php
            Options None
            AllowOverride All
            # This allows eveyone to access phpmyadmin, which you may not want
            Order Allow,Deny
            Allow from all
        </Directory>
</VirtualHost>

and hosts:

127.0.0.1       localhost
127.0.0.1       local
127.0.0.1       test3.local
127.0.0.1       admin.local

Ideally I'd like to not have to specify a virtual host for phpMyAdmin at all, because I'm sure to muck it up, and just somehow have the settings to make the Zend project work but to also have phpMyAdmin work like it did before.


Solution

  • Well, there's a good reason I was getting a 403 - I was digging in the wrong place. My installation of phpMyAdmin was actually in /srv/www/htdocs/phpMyAdmin. Changed that, restarted Apache (sudo systemctl restart apache2.service) and things seem to work.

    If you're interested in how the heck to find files and folders on openSUSE, the following steps worked for me:

    sudo zypper install findutils-locate
    su
    updatedb (go check your e-mail)
    locate phpMyAdmin (like that, not 'phpmyadmin')