RE: Virtual hosts and PHP downloads: php5 and apache22 on FreeBSD 6.1-STABLE

2006-06-07 Thread Robert Slade


-Original Message-
From: John DeStefano [mailto:[EMAIL PROTECTED] 
Sent: 07 June 2006 01:19
To: [EMAIL PROTECTED]
Subject: Re: Virtual hosts and PHP downloads: php5 and apache22 on FreeBSD
6.1-STABLE

 John,

 I have the same problem with a new install and asked the same question re
 php not working. One of the replys that I received was that the latest php
 port was broken and try the previous version. I haven't had chance to try
 that yet though.

 Rob

Hi Rob,

I'm hearing that too now as well... wish I'd realized it sooner.  I
wonder whether just reverting to an earlier version of PHP5 will be
enough though, or if it will also require an earlier apache version...
I guess we'll find out!

Thanks,
~John

John,

PHP4 works fine with Apache22, as I understand it; it is just the latest
port of PHP5 that the problem is with.

Rob

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Virtual hosts and PHP downloads: php5 and apache22 on FreeBSD 6.1-STABLE

2006-06-06 Thread Kevin Kinsey

John DeStefano wrote:

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 the
server and displaying the result in a browser, browsing to any page
containing PHP code resulted in a prompt to download the PHP page as a
file.


As you are probably already painfully aware, this is *usually*
due to the absence of the necessary lines in the httpd.conf file;
specifically, AddModule and LoadModule (pointing to the PHP shared
object) and AddType (referring to the MIME type for PHP files).


/usr/ports/UPGRADING mentions that PHP has been streamlined and must
be recompiled to work with Apache and other packages. After
deinstalling, configuring (where applicable), and reinstalling PHP5,
php5-extensions, and apache2 to the latest versions, not only were PHP
files not being served, but my web server was toast:
Forbidden You don't have permission to access / on this server.


Not toast, exactly.  Another configuration error, most likely.
httpd.conf tells the server which file(s) is/are acceptable as
INDEX files.  If all your index files were index.php, for
example, and the httpd.conf file (which is new, apparently?) says
that only index.html files are allowed as INDEX files, you'll
get this error every time.


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 some
very peculiar errors:
Warning: DocumentRoot [/www/docs/dummy-host.example.com] does not exist
Warning: DocumentRoot [/www/docs/dummy-host2.example.com] 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 these
dummy paths didn't exist in the config file!  I learned eventually
that a new apache directive splits out virtual host directives to a
new include file (/usr/local/etc/apache22/extra/httpd-vhosts.conf).
Then I learned after getting a server warning (NameVirtualHost *:80
has no VirtualHosts) that the syntax has been slightly modified, so
that the IP/port value of each VirtualHost specification must match
that of the NameVirtualHost directive (i.e., NameVirtualHost *:80
and VirtualHost *:80).

Still having trouble though: my main site loads properly, but the
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 www.SiteA.com
ServerAlias SiteA.com *.SiteA.com
DocumentRoot /usr/www
ErrorLog /var/log/httpd-SiteA-error.log
CustomLog /var/log/httpd-SiteA-access.log combined
/VirtualHost

VirtualHost *:80
ServerName www.SiteB.com
ServerAlias SiteB.com *.SiteB.com
DocumentRoot /usr/www2
ErrorLog /var/log/httpd-SiteB-error.log
CustomLog /var/log/httpd-SiteB-access.log combined
/VirtualHost



IANAE here, but that's not like my httpd.conf, in which
the ports aren't specified.  I also don't use ServerAlias
directives.  Like I said, no expert.


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 the
page as a file.

Any help on either the virtual hosts or the PHP download issue would
be greatly appreciated.



You said you did this already, but I'd again make **sure**
I was editing the correct httpd.conf.  Get the right syntax,
and it'll be there.  Watch out for IF syntax, also.

Can you post the relevant lines (AddModule, LoadModule, AddType)
and whether or not they are contained in an IF ??

Kevin Kinsey


--
How do you explain school to a higher intelligence?
-- Elliot, E.T.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Virtual hosts and PHP downloads: php5 and apache22 on FreeBSD 6.1-STABLE

2006-06-06 Thread John DeStefano

On 6/6/06, Kevin Kinsey [EMAIL PROTECTED] wrote:

John DeStefano wrote:
 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 the
 server and displaying the result in a browser, browsing to any page
 containing PHP code resulted in a prompt to download the PHP page as a
 file.

As you are probably already painfully aware, this is *usually*
due to the absence of the necessary lines in the httpd.conf file;
specifically, AddModule and LoadModule (pointing to the PHP shared
object) and AddType (referring to the MIME type for PHP files).


Hi Kevin.  Yes: painfully aware at this point.



 /usr/ports/UPGRADING mentions that PHP has been streamlined and must
 be recompiled to work with Apache and other packages. After
 deinstalling, configuring (where applicable), and reinstalling PHP5,
 php5-extensions, and apache2 to the latest versions, not only were PHP
 files not being served, but my web server was toast:
 Forbidden You don't have permission to access / on this server.

Not toast, exactly.  Another configuration error, most likely.
httpd.conf tells the server which file(s) is/are acceptable as
INDEX files.  If all your index files were index.php, for
example, and the httpd.conf file (which is new, apparently?) says
that only index.html files are allowed as INDEX files, you'll
get this error every time.


Yup... and with apache22, one of the benefits is that the PHP file
handler lines are automatically filled in when compiling PHP (although
I assume that would be the case with any version of apache as well).



 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 some
 very peculiar errors:
 Warning: DocumentRoot [/www/docs/dummy-host.example.com] does not exist
 Warning: DocumentRoot [/www/docs/dummy-host2.example.com] 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 these
 dummy paths didn't exist in the config file!  I learned eventually
 that a new apache directive splits out virtual host directives to a
 new include file (/usr/local/etc/apache22/extra/httpd-vhosts.conf).
 Then I learned after getting a server warning (NameVirtualHost *:80
 has no VirtualHosts) that the syntax has been slightly modified, so
 that the IP/port value of each VirtualHost specification must match
 that of the NameVirtualHost directive (i.e., NameVirtualHost *:80
 and VirtualHost *:80).

 Still having trouble though: my main site loads properly, but the
 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 www.SiteA.com
 ServerAlias SiteA.com *.SiteA.com
 DocumentRoot /usr/www
 ErrorLog /var/log/httpd-SiteA-error.log
 CustomLog /var/log/httpd-SiteA-access.log combined
 /VirtualHost

 VirtualHost *:80
 ServerName www.SiteB.com
 ServerAlias SiteB.com *.SiteB.com
 DocumentRoot /usr/www2
 ErrorLog /var/log/httpd-SiteB-error.log
 CustomLog /var/log/httpd-SiteB-access.log combined
 /VirtualHost


IANAE here, but that's not like my httpd.conf, in which
the ports aren't specified.  I also don't use ServerAlias
directives.  Like I said, no expert.


Right: that's not from the httpd.conf file itself any longer; it's the
httpd-vhosts.conf file, which is called on as an include in the 2.2
version of httpd.conf.  In earlier versions, the VirtualHost
directives have been moved from the main config file to that include
file.  And the IP/port specification for each VirtualHost entry must
now match that of the NameVirtualHost entry (as shown above).



 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 the
 page as a file.

 Any help on either the virtual hosts or the PHP download issue would
 be greatly appreciated.


You said you did this already, but I'd again make **sure**
I was editing the correct httpd.conf.  Get the right syntax,
and it'll be there.  Watch out for IF syntax, also.


I triple-checked the config to make sure apache is loading the correct
config file.  In fact, I've finally gotten the config to the point
where none of the apache self-tests report any syntax or configuration
errors at all.  Unfortunately, that doesn't mean it works as I'd
expected; just means there are no syntax errors.



Can you post the relevant lines (AddModule, LoadModule, AddType)
and whether or not they are contained in an IF ??


Please find my httpd.conf and httpd-vhosts.conf 

Re: Virtual hosts and PHP downloads: php5 and apache22 on FreeBSD 6.1-STABLE

2006-06-06 Thread Mikhail Goriachev
John DeStefano wrote:
 This body part will be downloaded on demand.
 


Remove unnecessary spaces from your httpd.conf:

AddType application/x- httpd-php .php
  ^
AddType application/x- httpd-php-source .phps
  ^

Make sure you clear cache on your browser before you test.

Cheers,
Mikhail.


-- 
Mikhail Goriachev
Webanoide

Telephone: +61 (0)3 62252501
Mobile Phone: +61 (0)4 38255158
E-Mail: [EMAIL PROTECTED]
Web: http://www.webanoide.org

PGP Key ID: 0x4E148A3B
PGP Key Fingerprint: D96B 7C14 79A5 8824 B99D 9562 F50E 2F5D 4E14 8A3B
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]