Virtual hosts and PHP "downloads": php5 and apache22 on FreeBSD6.1-STABLE

fbsd fbsd at
Wed Jun 7 02:18:57 UTC 2006

First and foremost, thanks for the reply.

On 6/6/06, fbsd <fbsd at> wrote:
> The php5 port is broken in 6.1.
> It no longer defaults to activating the php/apache module.

Thanks for that. I do appreciate it.

> This has been covered in great detail on this list in the past 6
> weeks which you would have found out if you reviewed the list
> archives before posting this question.

I may have missed a week or two, but the only responses I've seen
personally have been "see /usr/ports/UPDATING", which I did.  I'm
thrilled with the stock "RTFM" post, but I guess that's par for the

> After downloading the 6.1 version php5 port config files you have
> do "make config" and select the apache module. The "make install"
> will automatically make the correct changes to your httpd-config
> file for serving up php pages correctly. php5-extensions is not
> normally needed.

I did that.  That's pointed out in /usr/ports/UPDATING.
Unfortunately, it didn't automatically fix the issue for me.

******  thats because you are using the devel version of apache.
php4 & php5 are designed to auto update apache13  not apache22
you are on your own when you use devel apache22

Blow away apache22 and you can use the apache13 package for quick
then php5 port like said before. if you have previous working
apache13 httpd-config restore it to correct path after apache13
package install, then php5 port "make" will update it correctlly.

> Your other httpd-config problems are due to you using apache22
> instead of apache13 which is the rock hard production version of
> Apache web server. Apache22 is generally considered as the
> developmental version.

I was running 1.3 before my BSD upgrade to 6.1-STABLE.  There were
security issues with 1.3 that were not resolved at the time of my
upgrade.  And I assumed with the package changes to PHP5 in 6.1 that
going with an updated version of apache as well would be the best
method.  If you're saying I should revert back to 1.3, should I also
revert to an earlier version of PHP5, or is the latest and greatest
still best compatible with apache13?

*** I know of no security issues in apache13 in 6.1 release. your
6.1 install will give you the correct port version of php5. The
package php5 is broken because it does not contain the apache module
by default as in previous freebsd releases. you do have to cvs the
php5 config files plus the base make control files. go with it.

********* warning side note: be sure to comment out proxy module
statements in both places in httpd-conf. this will stop your web
server from being used to attack other systems without your
knowledge. ************

Thank you,
> -----Original Message-----
> From: owner-freebsd-questions at
> [mailto:owner-freebsd-questions at]On Behalf Of John
> DeStefano
> Sent: Tuesday, June 06, 2006 3:46 PM
> To: freebsd-questions at
> Subject: Virtual hosts and PHP "downloads": php5 and apache22 on
> I upgraded my system from 5.4-RELEASE to 6.1-STABLE last week, and
> my
> web server immediately stopped serving PHP pages, where I had no
> problem doing so before.  Instead of processing the PHP code on
> server and displaying the result in a browser, browsing to any
> containing PHP code resulted in a prompt to download the PHP page
> a
> file.
> /usr/ports/UPGRADING mentions that PHP has been streamlined and
> be recompiled to work with Apache and other packages. After
> deinstalling, configuring (where applicable), and reinstalling
> php5-extensions, and apache2 to the latest versions, not only were
> files not being served, but my web server was toast:
> "Forbidden You don't have permission to access / on this server."
> I edited the new apache config file (now located in
> /usr/local/etc/apache22/httpd.conf) with my system information,
> including a DocumentRoot path. But when I started apache, I got
> very peculiar errors:
> "Warning: DocumentRoot [/www/docs/] does not
> exist
> Warning: DocumentRoot [/www/docs/] does not
> exist"
> Not only did I confirm beforehand that I had set the DocumentRoot
> path, and that apache was using the correct config file... but
> "dummy" paths didn't exist in the config file!  I learned
> that a new apache directive splits out virtual host directives to
> new include file
> Then I learned after getting a server warning ("NameVirtualHost
> has no VirtualHosts") that the syntax has been slightly modified,
> that the IP/port value of each VirtualHost specification must
> that of the NameVirtualHost directive (i.e., "NameVirtualHost
> and "<VirtualHost *:80>").
> Still having trouble though: my "main" site loads properly, but
> other virtual hosts aren't. Browsing to any virtual host address
> other
> than the default results in either the wrong content or an error.
> Here's what my httpd-vhosts.conf looks like:
> NameVirtualHost *:80
> <VirtualHost *:80>
> ServerName
> ServerAlias *
> DocumentRoot /usr/www
> ErrorLog /var/log/httpd-SiteA-error.log
> CustomLog /var/log/httpd-SiteA-access.log combined
> </VirtualHost>
> <VirtualHost *:80>
> ServerName
> ServerAlias *
> DocumentRoot /usr/www2
> ErrorLog /var/log/httpd-SiteB-error.log
> CustomLog /var/log/httpd-SiteB-access.log combined
> </VirtualHost>
> So, what's happening is that SiteA works as expected, but browsing
> to
> SiteB brings you to SiteA, or doesn't load at all ("403" error).
> In addition, I'm back to my original problem, where PHP files are
> not
> loading, and browsing to a PHP page prompts the user to download
> page as a file.
> Any help on either the virtual hosts or the PHP download issue
> be greatly appreciated.
> Thanks,
> ~John

More information about the freebsd-questions mailing list