开发者

Why does my virtual host XAMPP not be able to display the php file?

开发者 https://www.devze.com 2023-02-07 15:22 出处:网络
I am trying to set up a virtual host so that I can run my .php file from Eclipse as a web page. I follow the instructions from this discussion:

I am trying to set up a virtual host so that I can run my .php file from Eclipse as a web page.

I follow the instructions from this discussion:

Make XAMPP/Apache serve file outside of 开发者_开发百科htdocs

Scroll down to virtual hosts and the instruction is basically

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "/Users/Oky/Documents/eclipse/firstEclipseProject/"
    ServerName firstEclipseProject.localhost
    ErrorLog "/Users/Oky/Documents/eclipse/firstEclipseProject/logs/error_log"
    <Directory /Users/Oky/Documents/eclipse/firstEclipseProject/>
        Order allow,deny
        Allow from all
    </Directory>    
    CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>

The document is at /Application/XAMPP/etc/extra/httpd-vhosts.conf

Then I change the hosts file at /private/etc/hosts and at the bottom, I added

127.0.0.1 firstEclipseProject.localhost #firstEclipseProject

So, I think I am doing it right up to this point because when I fire my browser and point to firsteclipseproject.localhost, it redirects me to

firsteclipseproject.localhost/XAMPP/ 

which is the main XAMPP web page. It does not return an object/page not found which means the redirecting is somewhat working.

So, in /Users/Oky/Documents/eclipse/firstEclipseProject/ I created a php file called HelloWorld.php but when I point to firsteclipseproject.localhost/HelloWorld.php, it says object not found! I also tried firsteclipseproject.localhost/XAMPP/HelloWorld.php and it fails.

Any help is appreciated! Thanks!!!


I would suggest you leave the root directory the way it is and instead setup an Alias to your eclipse directory.


Did you restart apache after making config changes?

0

精彩评论

暂无评论...
验证码 换一张
取 消