LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-28-2004, 03:39 PM   #1
XTJ7
LQ Newbie
 
Registered: Apr 2004
Location: Germany
Distribution: SuSE 9.1
Posts: 14

Rep: Reputation: 0
SuSE 9.1, Apache2 & prefork MPM, PHP4


I am using SuSE 9.1, Kernel 2.6.4 with Apache 2.0.49 and trying to get PHP 4.3.4 to work.
So far so good, actually I thought it was easy to set up a webserver, like I did many times before (using Apache 1.3.x and 2.0.x until 2.0.43), but something seems to be very different with Apache 2.0.49.
The general use of the apache2-prefork MPM together with SSL seems already to be not working properly. So I went to /etc/sysconfig/apache2 and excluded it of the list APACHE_MODULES.
I googled a lot but I haven't found anything useful to get PHP with this version of Apache to work. At least nothing that would help me. I haven't edited anything so far but just installed the apache2 RPM, the apache2-mod_php4 RPM and a few other modules for apache2. This seemed to be all working, without SSL the Apache2 with prefork MPM starts without any problems, all test ran without any errors. As soon as I plan to do something regarding PHP it gets a pain in the ass. I add to APACHE_MODULES "php4" at the end of the list separated by a space, resulting a line like

APACHE_MODULES="access actions alias auth auth_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif suexec userdir php4"

No result, start fails but the runtime-created file loadmodules.conf contains a line for loading the php module. It doesn't if I use the worker MPM (what seems to be alright). It doesn't as well as soon as I change that php4 to php. Then the apache2 seems to be working properly without any errors, but php doesn't work as well.
So I used the minimal apache module configuration and made a line like

APACHE_MODULES="access alias auth dir log_config mime setenvif php"

The same as when I used the long version. Same goes with:

APACHE_MODULES="access alias auth dir log_config mime setenvif php4"

Unfortunately all the time none of the tests failed, nothing was written to the error log (except suexec and ssl as I was using it. After removing it the log was in fact empty but that made no difference as nothing with the apache nor php changed.)

As soon as I open any php file with a browser, the browser wants to download that file (No matter what browser. So it's in any case a serverside-problem).
I don't know what to do and did hours of research with google. No way for a solution. Every howto ended with the same result. It just wasn't running as it should be. Could this be a SuSE 9.1 problem? Or do I really have to delete all that crap and compile the Apache2 and PHP myself?
Thanks in advance.

Last edited by XTJ7; 04-28-2004 at 03:53 PM.
 
Old 04-28-2004, 03:46 PM   #2
Matt Collier
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 80

Rep: Reputation: 15
sounds like you don't have the AddType directives set for php

add

AddType application/x-httpd-php .php
#optional
#AddType application/x-httpd-php-source .phps

to httpd.conf
 
Old 04-28-2004, 03:49 PM   #3
XTJ7
LQ Newbie
 
Registered: Apr 2004
Location: Germany
Distribution: SuSE 9.1
Posts: 14

Original Poster
Rep: Reputation: 0
Ah, sorry, I knew I forgot something. I did that as well as
DirectoryIndex index.html index.php

But it's the same result after all. If I enter a directory that contains a file named index.php the browser automatically wants to download that file. Somehow this might be right, but not in the case that the server should parse the php code. It doesn't.

Thanks for your reply.
 
Old 04-29-2004, 07:40 AM   #4
XTJ7
LQ Newbie
 
Registered: Apr 2004
Location: Germany
Distribution: SuSE 9.1
Posts: 14

Original Poster
Rep: Reputation: 0
No ideas? I've got no clue what's wrong. There must be some fundamental changes within Apache - I don't know. But I did everything as always and until now there weren't any problems. And now from one version to another - and no dramatically version change but from 2.0.43 to 2.0.49 - I can't get PHP to work.
 
Old 04-29-2004, 10:04 AM   #5
Matt Collier
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 80

Rep: Reputation: 15
Not really, if the handler is present, then it looks like apache can't find the interpreter (php4) and is just giving the file out instead of server parsing it. but that would surely show up the the error logs.

i can only assume that either the php4 module isn't being loaded, or php4 isn't doing anything.

The only 2 lines you should need are:

LoadModule php4_module /usr/lib/apache2/modules/libphp4.so
AddType application/x-httpd-php .php

anything else isn't strictly necessary.

could it be that the module isn't named php4, or it's not in the same path as the others, and requires it's own LoadModule directive?

try locating libphp4.so and putting it on it's own LoadModule line
 
Old 04-29-2004, 11:07 AM   #6
XTJ7
LQ Newbie
 
Registered: Apr 2004
Location: Germany
Distribution: SuSE 9.1
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks. I tried that with
LoadModule php4_module /usr/lib/apache2-prefork/libphp4.so
AddType application/x-httpd-php .php
(Thats where the lib is located and accessible).
But it's no use, as soon as I try starting the apache webserver it says
Starting httpd2 (prefork) failed
So I thought maybe something with php itself is wrong and reinstalled it a few times. But after entering php in the shell theres just one line showing up after it quits. "Speicherzugriffsfehler", what in english means something like memory access fault/error.
Could this be the reason, that the Apache 2 doesn't start? I think it has to be because the Apache 2 is running php as sapi and so it is neccessary that php starts properly, isn't it?

Thanks for your reply. Seems to be like that. Does anyone have another idea?
 
Old 04-29-2004, 02:43 PM   #7
XTJ7
LQ Newbie
 
Registered: Apr 2004
Location: Germany
Distribution: SuSE 9.1
Posts: 14

Original Poster
Rep: Reputation: 0
After making intensive use of trial&error I found a solution.
SuSE 9.1 contains one PHP module, that is causing all the trouble. The module is the php4 imap module, after uninstalling that one everything worked fine.
As I don't mind not using that module I am fine with that solution.

[Edit]There seems to be a mistake with the dependencies in SuSE 9.1: If you install IMAP, the IMAP module works [/Edit]

Have fun.

Last edited by XTJ7; 04-30-2004 at 08:07 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2 worker works, prefork doesn't AlexH Suse/Novell 1 10-18-2004 11:15 AM
Mandrake & Apache2/php4.2.3 how to enable GD extensions sablecurls Mandriva 1 07-09-2004 02:35 PM
apache2.0, php4.2.2, & mysql3.23.58 - undefined function: mysql_pconnect() BrianK Programming 2 02-22-2004 06:58 AM
apache2 prefork + php4 + mysql rymonree Linux - Software 1 09-06-2003 02:03 PM
Apache2 & php4 CyberDrake Linux - Newbie 2 11-25-2002 11:32 AM


All times are GMT -5. The time now is 01:30 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration