views:

52

answers:

2

I have a Zend Framework project on a local machine, and as recommended its /public subfolder is made a DocumentRoot in httpd.conf. So I access this app simply with http://localhost.

This new requirement makes me unable to access other web apps in a former webserver root (which contains a few regular php apps and a couple of zend framework apps).

What configuration should I choose to be able to simultaneously access both ZF root-based apps and other apps like PHPMYADMIN?

A: 

Zend Framework probably uses a .htaccess file. If so, you might use that to add rules to leave the other apps alone. Another option is to use subdomain (eg phpmyadmin.localhost)

koen
+4  A: 

You'll probably need to use some kind of VirtualHost

You have at least two solutions :


In the second case (the solution I always use), you will have to edit your "hosts" file, so "mytestwebsite" is an alias to your local machine -- which IP address is 127.0.0.1
Under windows, this file is located in C:\WINDOWS\system32\drivers\etc
On Linux, it's in /etc/

You'd have to add a line like these ones :

127.0.0.1       localhost
127.0.0.1       mytestwebsite

Then, in the Apache configuration, you need to create one VirtualHost per site. Something like this, I suppose :

<VirtualHost *>
    ServerName      mytestwebsite
    DocumentRoot /home/squale/developpement/tests
    <Directory /home/squale/developpement/tests>
        Options Indexes FollowSymLinks MultiViews +SymLinksIfOwnerMatch
        AllowOverride All
    </Directory>
</VirtualHost>

<VirtualHost *>
    ServerName      myothertestwebsite
    DocumentRoot /.../myothertestwebsite
    <Directory /.../myothertestwebsite>
        Options Indexes FollowSymLinks MultiViews +SymLinksIfOwnerMatch
        AllowOverride All
    </Directory>
</VirtualHost>

(Needs tunning / configuration, of course)

And you'll also probably need some directive like this one :

NameVirtualHost *

Well, this might not be the entire solution (that one depends on your server / applications) ; but I hope these few pointers will help you get to it !

If you need more help, the keyword is "VirtualHost" ;-)

Have fun !

Pascal MARTIN
That works and directive "NameVirtualHost *" was really useful to have two hosts at a time. Pascal, thanks for increasing my PHP productivity!
PHP thinker
You're welcome :-) Have fun !
Pascal MARTIN
I'm having like 20 different projects like this. Works like charm.
Tomáš Fejfar