Forum Moderators: coopster
I have a number of sites using apache and php. Problems start to occur when I wish to do full development stuff with databases, includes etc. Fine, I can set one site to root so that all the includes and paths work OK. But how do you do with multiple sites.
Subdomains sound a possibility but not on my local development machine (windows running apache)
How do you handle such things. Would or do aliases work.
Regards
<IfModule mod_php4.c>
php_value include_path .:/path/to/shared/directory
</IfModule>
Then in a PHP file anywhere on the server you can jsut "include" any file in that directory as if it was in the current directory.
Make sense?
Alias /ban/ "F:/ban/"
<Directory "F:/ban/">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from localhost 127.0.0.1
DirectoryIndex index.php
</Directory>
As you mentioned the includes are causing problems.
Do I need to use the following in some way?
<IfModule mod_php4.c>
php_value include_path .:/path/to/shared/directory
</IfModule>
On a related theme as well, will I have to alter my rewrite rules to include the extra folder?.
that would look like this:
127.0.0.1 localhost site1 site2
and so on for each site, use only one line, no commas, no linebreak for all your sites, save that back into that directory, then add the following, remember that you have to restart apache each time you make a change to the httpd.conf file before it takes affect.
NameVirtualHost 127.0.0.1:80
##LOCALHOST##
<VirtualHost 127.0.0.1:80>
ServerName localhost
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/program files/apache group/apache2/htdocs"
</VirtualHost>
## site 1 ##
<VirtualHost 127.0.0.1:80>
ServerName site1
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/websites/site1"
<Directory "c:/websites/site1">
AllowOverride None
</Directory>
php_value include_path ".;c:/websites/site1/includes"
DirectoryIndex index.php index.html index.htm
</VirtualHost>
## site2 ##
<VirtualHost 127.0.0.1:80>
ServerName site2
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/websites/site2"
<Directory "c:/websites/site2">
AllowOverride None
</Directory>
php_value include_path ".;c:/websites/site2/includes"
DirectoryIndex index.html index.htm
</VirtualHost>
Thanks for that. I will have to play.
What I have been finding problematic is my links. When I got to the folder [localhost...] all the pages work fin but the links take it back to root, which is a bit of a nause.
Cheers