View previous topic :: View next topic |
Author |
Message |
fredgt Apprentice

Joined: 06 Dec 2004 Posts: 168 Location: Belgium
|
Posted: Fri Dec 17, 2004 7:28 pm Post subject: apache2 and PHP (can't get php to work) |
|
|
I've only recently started using gentoo(for my laptop) and i think it's and everything is working great so i decided to also transfer my "server" ( for home use ftp / http / ssh / mysql ) to Gentoo. Proftpd, opensshd and mysql work perfectly but i've got some problems with my apache2 server. I can't get PHP to work. The server works fine with plain html but not with php, it displays nothing but when you view the sourcefile received on the client you can see the php syntax wich should not be possible if the phpmodule was working.
I edited /etc/conf.d/apache2 , i changed APACHE2_OPTS to "-D PHP4"
So it should be loading PHP4
To be certain i also checked it /etc/apache2/conf/modules.d even had a configuration file for PHP4 but it does.
I don't get any warnings when starting apache2 so i thought that the module would be running but i think it's not.
Can i check if apache2 has actualy loaded the module when it's running?
Do i need other configurations, or am i forgetting something else? |
|
Back to top |
|
 |
yain n00b

Joined: 15 Dec 2004 Posts: 16
|
Posted: Fri Dec 17, 2004 8:03 pm Post subject: |
|
|
Quote: | The server works fine with plain html but not with php, it displays nothing but when you view the sourcefile received on the client you can see the php syntax wich should not be possible if the phpmodule was working. |
have you added:
Code: | AddType application/x-httpd-php .php |
to httpd config?
Quote: | Can i check if apache2 has actualy loaded the module when it's running? |
depending on your configuration you should see something like that in http response headers:
Code: | Server: Apache/1.3.31 (Unix) PHP/4.3.9 |
|
|
Back to top |
|
 |
fredgt Apprentice

Joined: 06 Dec 2004 Posts: 168 Location: Belgium
|
Posted: Fri Dec 17, 2004 9:20 pm Post subject: |
|
|
Got it working. Thanks (php was working but there was a file extention problem)
Server is almost complete  |
|
Back to top |
|
 |
macawgumbo Apprentice

Joined: 28 May 2004 Posts: 165
|
Posted: Sat Dec 18, 2004 12:16 am Post subject: |
|
|
Is using php4 with apache2 a good idea? |
|
Back to top |
|
 |
tierra n00b

Joined: 22 Jun 2003 Posts: 13
|
Posted: Sat Dec 18, 2004 12:21 am Post subject: |
|
|
macawgumbo wrote: | Is using php4 with apache2 a good idea? |
Seeing as how both of them are now the default installed versions, and both are stable, yes. I've read some notes before about using mod_php versus CGI warning that mod_php is still the less tested way of doing it, but seems to show some significant performance improvements. I hope that was the answer you were looking for. |
|
Back to top |
|
 |
macawgumbo Apprentice

Joined: 28 May 2004 Posts: 165
|
Posted: Sat Dec 18, 2004 12:28 am Post subject: |
|
|
good enough. just was wondering because of the warning in php.net's documentation about not using apache2 and php in production. Also, php4 vs. php5? I am learning php4 out of a book and that will be compatible with php5 if it is installed right? |
|
Back to top |
|
 |
deflin39 Tux's lil' helper


Joined: 06 Jun 2004 Posts: 105 Location: /dev/BIYJ
|
Posted: Sat Dec 18, 2004 3:05 am Post subject: |
|
|
macawgumbo wrote: | good enough. just was wondering because of the warning in php.net's documentation about not using apache2 and php in production. Also, php4 vs. php5? I am learning php4 out of a book and that will be compatible with php5 if it is installed right? |
IIRC, PHP5 is backward compatable with PHP4. most of the changes had to do with the way the ZEND engine worked with Object Oriented code. I could be wrong here though. All the code I migrated from PHP4 worked fine though.
deflin39 _________________ The musicians today, who don't do drugs, and in fact speak out against it-"We're rockers against drugs"-boy, they suck. Suck. Ball-less, soul-less, spirit-less, corporate little bitches, suckers of Satan's cock, each and every one of themBillHicks |
|
Back to top |
|
 |
yain n00b

Joined: 15 Dec 2004 Posts: 16
|
Posted: Sat Dec 18, 2004 2:26 pm Post subject: |
|
|
macawgumbo wrote: | Is using php4 with apache2 a good idea? |
no it's not.
apache2 uses threads instead of fork and though zend engine itself IS thread safe, some of the php modules certainly isn't.
this is being fixed, but apache2+php4 is not production quality bundle yet.
also you can build apache2 in prefork mode, but then it's not apache2 and doing so doesn't make sense really... |
|
Back to top |
|
 |
macawgumbo Apprentice

Joined: 28 May 2004 Posts: 165
|
Posted: Sat Dec 18, 2004 9:58 pm Post subject: |
|
|
So for a home server with maximum uptime , would you recommend PHP5 & Apache2? or PHP4 & Apache 1.3? or any other combination? (or IIS, ) |
|
Back to top |
|
 |
yain n00b

Joined: 15 Dec 2004 Posts: 16
|
Posted: Sat Dec 18, 2004 11:26 pm Post subject: |
|
|
apache 1.3.(latest) plus latest php, either branch 4 or 5 should be stable enough.
I actually don't see any benefit in using apache2 at all (that's my opinion). and it surely will contribute some instability when used with php. |
|
Back to top |
|
 |
macawgumbo Apprentice

Joined: 28 May 2004 Posts: 165
|
Posted: Fri Feb 04, 2005 3:11 am Post subject: |
|
|
Remember to ease configuration run the ebuild command.
Code: | ebuild /var/db/pkg/[app group (ex. dev-db)]/[package and version (ex. mysql-4.0.23-r2)]/[package and version.ebuild (ex. mysql-4.0.23-r2.ebuild)] config |
This will configure the package and with mod_php will add the application type and php opts to the config file for you. Portage is not only good, its the best. |
|
Back to top |
|
 |
|