PHP not work after virtualhost added

Hi all,

I use openSUSE 13.1 on my laptop. I’m an web developer and I want to use my laptop as server. I found this howtoand I followed it’s instructions. Everything is OK at the end of fifth point. After this I want to adding one virtualhost to my LAMP server.
Then I cannot reach my demo pages (2.3 and 3.3 in the howto) and I cannot reach phpMyAdmin too. I try to restart apache2, laptop, everything, but it’s not work. When I reinstalled the whole of LAMP it works again. But when I try to adding virtualhost to my config, everything is dead.

This is my /etc/apache2/vhosts.d/thone.local.conf file’s content:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName thone.local

    DocumentRoot "/srv/www/richard/thone"

    <Directory "/srv/www/richard/thone">
        Options FollowSymLinks Indexes
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>

When the LAMP is not OK, I get empty webpage on PHP or HTML files and I get 404 on bad filenames.

What is the problem and how to can I repair that?

I suppose that’s because you set a new DocumentRoot for the virtual host.
You cannot access the stuff in the old DocumentRoot (/srv/www/htdocs/) any more then of course, which is where phpMyAdmin is installed to and the example pages.

With this VirtualHost configuration, you have to copy everything you want to be able to access to /srv/www/richard/thone/.

Hm, really. How can I set DocumentRoot for the virtualhost only? I want to working with more domain (e.g. thone.local, drupal.local, wordpress.local, etc.) and use phpMyAdmin at the same time. How can I do this?

Thanks for your help.

It is set for the virtualhost only.
But Apache thinks that you want to access that virtualhost.

I want to working with more domain (e.g. thone.local, drupal.local, wordpress.local, etc.) and use phpMyAdmin at the same time. How can I do this?

You would have to use “name based virtual hosts” in this case.
See here:
http://httpd.apache.org/docs/current/vhosts/name-based.html
Where that document speaks about httpd.conf, you should of course use the virtualhost config files in /etc/apache2/vhosts.d/.
You can use a separate file for each virtualhost, or put everything into one file.

IIRC you can still get to the standard document root (/srv/www/htdocs/) where your phpMyAdmin is, by accessing the sever via th IP-Adress instead of a name.
Or just configure an additional virtualhost that has /srv/www/htdocs/ as DocumentRoot.

Oh, it need to create a .conf file to the “localhost” servername too. It works now.

Thank you very much.