Colin Harrington

Tag: Apache

Configure PHP per Apache Virtual Host

by on Jul.02, 2008, under General

Yea I know… PHP.  Please don’t shoot me.  Its not as groovy as say … Groovy or Ruby, but it can get the Job done.  I just found out how to configure PHP per virtual host. I guess I knew that it was possible, I just did not know how to do it.  Tomorrow I’m planning on forgetting how to do it and have to look it up again, which is exactly why I’ll blog about it :-).

So Basically you can set specific PHP.ini settings in the virtual host definition.  There are other ways of configuring PHP, but this one seems to be aligned to virtual hosts and is the right tool for the job I had to do.

PHP alania tipped me off to PHP.net’s article on the subject.  It would look similar to:

 <virtualhost>
    DocumentRoot "C:\non\aya\business\public_html"
    ServerName www.somesite.com
    ServerAlias somesite.com
    <directory>
        Allow from all
        php_admin_flag short_open_tag off
    </directory>
</virtualhost>

Don’t forget that you could also configure PHP on the fly (while its running/executing) by utilizing the ini_set() function.

Happy PHP-ing!

 

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!