Results 1 to 5 of 5

Thread: PHP not work after virtualhost added

  1. #1
    Join Date
    May 2014
    Location
    Pécs, Hungary
    Posts
    5

    Unhappy 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 howto and 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:
    Code:
    <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?

  2. #2

    Default Re: PHP not work after virtualhost added

    Quote Originally Posted by eszesrichard View Post
    This is my /etc/apache2/vhosts.d/thone.local.conf file's content:
    Code:
    <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>
    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/.

  3. #3
    Join Date
    May 2014
    Location
    Pécs, Hungary
    Posts
    5

    Default Re: PHP not work after virtualhost added

    Quote Originally Posted by wolfi323 View Post
    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.

  4. #4

    Default Re: PHP not work after virtualhost added

    Quote Originally Posted by eszesrichard View Post
    Hm, really. How can I set DocumentRoot for the virtualhost only?
    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...ame-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.
    Last edited by wolfi323; 03-May-2014 at 15:52.

  5. #5
    Join Date
    May 2014
    Location
    Pécs, Hungary
    Posts
    5

    Default Re: PHP not work after virtualhost added

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

    Thank you very much.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •