Re: [SLE] Configuring Apache for php on SuSE 9.3 Pro
Randy Wyatt wrote:
Isn't a LoadModule Required near the Modules section of httpd.conf ?
I checked for what LoadModule might be required and found: "LoadModule php4_module modules/libphp4.so" via Google. I also checked /var/log/apache2/error_log and found: "[error] an unknown filter was not added: PHP" So I did: "locate libphp4.so" and got nothing back. I also checked in /usr/lib and /usr/lib/php and sub-directories and couldn't locate it. According to YaST2 I have every PHP package installed with the exception of the old format packages and: -devel -php4-fastcgi -php4-pgsql -php4-recode -php4-servlet Which all looks OK to me. Any ideas what's happening here? I don't understand it at all (but that's nothing new for me). Thanks Peter
Sorry for replying to my own post, but I've got some more info and didn't want anyone wasting time on the old info. I ran updatedb and so I've now found libphp4.so. It's in /usr/lib/apach2-prefork So can anyone tell me what the LoadModule entry ought to look like? Should it be exactly as it is below, or do I have to change it to reflect the library's location on my machine? Thanks Peter peter wrote:
Randy Wyatt wrote:
Isn't a LoadModule Required near the Modules section of httpd.conf ?
I checked for what LoadModule might be required and found:
"LoadModule php4_module modules/libphp4.so"
via Google.
I also checked /var/log/apache2/error_log and found:
"[error] an unknown filter was not added: PHP"
So I did:
"locate libphp4.so"
and got nothing back. I also checked in /usr/lib and /usr/lib/php and sub-directories and couldn't locate it.
According to YaST2 I have every PHP package installed with the exception of the old format packages and: -devel -php4-fastcgi -php4-pgsql -php4-recode -php4-servlet
Which all looks OK to me.
Any ideas what's happening here? I don't understand it at all (but that's nothing new for me).
Thanks
Peter
* peter
I ran updatedb and so I've now found libphp4.so. It's in /usr/lib/apach2-prefork
So can anyone tell me what the LoadModule entry ought to look like? Should it be exactly as it is below, or do I have to change it to reflect the library's location on my machine?
/etc/apache2/sysconfig.d/loadmodule.conf LoadModule php4_module /usr/lib/apache2-prefork/libphp4.so -- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2
Patrick Shanahan wrote:
/etc/apache2/sysconfig.d/loadmodule.conf LoadModule php4_module /usr/lib/apache2-prefork/libphp4.so
Thanks, Patrick. I did that (but in the file /etc/apache2/config.d/php4.conf). When I restarted Apache, I got the message: Starting httpd2 (prefork) [Wed May 10 20:07:59 2006] [warn] module php4_module is already loaded, skipping [Wed May 10 20:07:59 2006] [warn] module php4_module is already loaded, skipping But when I tried to display a php page in a browser I got the same error. So no luck there, I'm afraid. Peter
* peter
Starting httpd2 (prefork) [Wed May 10 20:07:59 2006] [warn] module php4_module is already loaded, skipping [Wed May 10 20:07:59 2006] [warn] module php4_module is already loaded, skipping
suggests two (multiple) entries ... I would delete the just added entry as it appears to have already been present.
But when I tried to display a php page in a browser I got the same error. So no luck there, I'm afraid.
How are you attempting to display the php files? http://localhost/self.php cat /srv/www/htdocs/self.php <? phpinfo() ?> Should display your php configuration -- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2
Replies interspersed ... Patrick Shanahan wrote:
suggests two (multiple) entries ... I would delete the just added entry as it appears to have already been present.
Done. And the error disappears on restart.
How are you attempting to display the php files?
http://localhost/index.php Just a Hello World! file, i.e. <HTML> <HEAD> <TITLE> PHP Test </TITLE> </HEAD> <BODY> <?php print "<h1>Hello World!</h1>" ?> </BODY> </HTML>
cat /srv/www/htdocs/self.php <? phpinfo() ?>
Should display your php configuration
As should index.php display "Hello World!" :-) But I created it, just to try ... and unfortunately all I get is Firefox telling me I'm trying to open a php script, and would I like to use a text editor to do so, as I do with my index.php script. :-( Could it be a permissions thing? The default httpd.conf has an entry that says something like "Deny All", and the htdocs directory is 755 root:root. But I would have expected "Access Denied" from Apache if it was a permissions problem ... Peter
* peter
As should index.php display "Hello World!" :-)
But I created it, just to try ... and unfortunately all I get is Firefox telling me I'm trying to open a php script, and would I like to use a text editor to do so, as I do with my index.php script.
:-(
Could it be a permissions thing? The default httpd.conf has an entry that says something like "Deny All", and the htdocs directory is 755 root:root. But I would have expected "Access Denied" from Apache if it was a permissions problem ...
Looking at your file, I believe that it is not a php script, should start with "http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2
Patrick Shanahan wrote:
Looking at your file, I believe that it is not a php script, should start with "
Yeah. I did. It's just the same. The apache2 error_log says: [error] an unknown filter was not added: PHP Once for each attempt to run the script Peter
* peter
Yeah. I did. It's just the same. The apache2 error_log says:
[error] an unknown filter was not added: PHP
Once for each attempt to run the script
Then, I'm sorry. I know not what to do next. -- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2
Patrick Shanahan wrote:
Then, I'm sorry. I know not what to do next.
Fair enough, Patrick. Thanks for trying to help. I'll give it a day or two and see if anyone else has any ideas. If not, I'll uninstall Apache and PHP and start again from scratch to see if that works. Thanks again Peter
Patrick Shanahan wrote:
Then, I'm sorry. I know not what to do next.
Fair enough, Patrick. Thanks for trying to help.
I'll give it a day or two and see if anyone else has any ideas. If not, I'll uninstall Apache and PHP and start again from scratch to see if that works.
Thanks again
Peter Peter you don't say if your trying to install from RPMs or compile. I found
On Wednesday 10 May 2006 13:54, you wrote: the following document somewhat helpful even thought I used RPM's to install. I have a PHP5, MySQl and Apache2 running but only through localhost at this time. Still developing my website. http://www.builderau.com.au/program/0,39024614,39130604,00.htm Hope this helps you a little. -- Russ
Russbucket wrote:
Peter you don't say if your trying to install from RPMs or compile. I found the following document somewhat helpful even thought I used RPM's to install. I have a PHP5, MySQl and Apache2 running but only through localhost at this time. Still developing my website.
http://www.builderau.com.au/program/0,39024614,39130604,00.htm
Hope this helps you a little.
Thanks Russ. I'll look it up. I'm installing from RPMs via YaST2, by the way. So it should all just work. At the moment I'm favouring doing a complete reinstall of all the bits. I'm not putting any public web sites up on it. I just want it for development purposes. Peter
peter wrote:
I'm installing from RPMs via YaST2, by the way. So it should all just work. At the moment I'm favouring doing a complete reinstall of all the bits. I'm not putting any public web sites up on it. I just want it for development purposes.
I've just checked in YaST and I see that I have apache2 and apache2-prefork both installed. Should I have both of them? If not, which one should I keep for use with php? Cheers Peter
peter wrote:
I've just checked in YaST and I see that I have apache2 and apache2-prefork both installed. Should I have both of them?
Yes. One is sort of the apache base-config, the other is apache plus the type of process/thread organisation. /Per Jessen, Zürich
Patrick Shanahan wrote:
Then, I'm sorry. I know not what to do next.
Fair enough, Patrick. Thanks for trying to help.
I'll give it a day or two and see if anyone else has any ideas. If not, I'll uninstall Apache and PHP and start again from scratch to see if that works.
Thanks again
Peter Peter you don't say if your trying to install from RPMs or compile. I found
On Wednesday 10 May 2006 13:54, you wrote: the following document somewhat helpful even thought I used RPM's to install. I have a PHP5, MySQl and Apache2 running but only through localhost at this time. Still developing my website. http://www.builderau.com.au/program/0,39024614,39130604,00.htm Hope this helps you a little. -- Russ
peter wrote:
But I created it, just to try ... and unfortunately all I get is Firefox telling me I'm trying to open a php script, and would I like to use a text editor to do so, as I do with my index.php script.
Does your apache config have a line like this: AddType application/x-httpd-php php /Per Jessen, Zürich
Per Jessen wrote:
Does your apache config have a line like this:
AddType application/x-httpd-php php
/Per Jessen, Zürich
Hi Per,
Yes. It's in /etc/apache2/conf.d/php4.conf
# Added by PB 09.05.2006
peter wrote:
Yes. It's in /etc/apache2/conf.d/php4.conf
# Added by PB 09.05.2006
SetOutputFilter PHP SetInputFilter PHP LimitRequestBody 9524288 </Files> # End PB addition 09.15.2006
<IfModule sapi_apache2.c> AddType application/x-httpd-php .php AddType application/x-httpd-php .php3 AddType application/x-httpd-php .php4 AddType application/x-httpd-php-source .phps DirectoryIndex index.php DirectoryIndex index.php3 DirectoryIndex index.php4 </IfModule>
OK, and you know for a fact that that section is active? As in, is that module loaded? I'm not sure what the purpose of the initial <Files> section - my config doesn't use it. /Per Jessen, Zürich
Per Jessen wrote:
OK, and you know for a fact that that section is active? As in, is that module loaded? I'm not sure what the purpose of the initial <Files> section - my config doesn't use it.
/Per Jessen, Zürich
I'm sure as I can be. For example, if I put a LoadModule directive in, I get an error message on restarting Apache that says something like, "Module already loaded, skipping". Take it out and the error message goes away. I am to systems admin what a fish is to mountaineering, so I may have drawn a wrong conclusion here - but either way it doesn't work (even with the redundant - apparently - LoadModule) Peter
peter wrote:
I'm sure as I can be. For example, if I put a LoadModule directive in, I get an error message on restarting Apache that says something like, "Module already loaded, skipping". Take it out and the error message goes away.
OK, good test.
I am to systems admin what a fish is to mountaineering, so I may have drawn a wrong conclusion here - but either way it doesn't work (even with the redundant - apparently - LoadModule)
OK, let's recap for a second - you're using apache 2.x.5x and you're having problems getting it to run PHP. PHP code is being served as PHP code instead of being interpreted and turned into plain HTML. Which PHP version are you using - 4 or 5? Try commenting out your <IfModule sapi_apache2.c> directives, and see what happens. /Per Jessen, Zürich
Per Jessen wrote:
OK, let's recap for a second -
you're using apache 2.x.5x and you're having problems getting it to run PHP. PHP code is being served as PHP code instead of being interpreted and turned into plain HTML.
I have Apache2 version 9.0.54-0.1. In htdocs, I have a file called index.php and one called self.php. The contents of index.php are just a call to print, saying "Hello World!" (unsurprisingly). The contents of self.php are just a call to phpinfo(). If I type: http://localhost/ into Firefox, then nothing is returned (View Source returns a blank screen). If I add the filename to the URL (either index.php) or (self.php), then Firefox just puts up a dialog asking me what program I want to use to open the file - and suggests a text editor.
Which PHP version are you using - 4 or 5?
php4.3.10.14 apche2-mod_php4.3.10-14.2
Try commenting out your <IfModule sapi_apache2.c> directives, and see what happens.
The result is the same, I'm afraid. I had actually tried it already. Cheers Peter
peter wrote:
I have Apache2 version 9.0.54-0.1. In htdocs, I have a file called index.php and one called self.php. The contents of index.php are just a call to print, saying "Hello World!" (unsurprisingly). The contents of self.php are just a call to phpinfo().
OK, sounds good. And you also have a "DirectoryIndex index.php" statement, right? Did you have multiple of those? I would stick to just one "DirectoryIndex index".
If I type: http://localhost/ into Firefox, then nothing is returned (View Source returns a blank screen).
That could suggest a segfault somewhere. Have you checked the error-logs, e.g. /var/log/apachex/error* ?
If I add the filename to the URL (either index.php) or (self.php), then Firefox just puts up a dialog asking me what program I want to use to open the file - and suggests a text editor.
Right - that says that the file being served has not been processed by the php interpreter, and is being served raw. So somehow the php interpreter isn't being invoked or isn't working. Your software-versions look good - just about the same that I'm using. What about the <Files> section you showe at some point - have you also tried without it? I don't use one of those. /Per Jessen, Zürich
Per Jessen wrote:
OK, sounds good. And you also have a "DirectoryIndex index.php" statement, right? Did you have multiple of those? I would stick to just one "DirectoryIndex index".
(see below)
That could suggest a segfault somewhere. Have you checked the error-logs, e.g. /var/log/apachex/error* ?
(see below)
Right - that says that the file being served has not been processed by the php interpreter, and is being served raw. So somehow the php interpreter isn't being invoked or isn't working.
Your software-versions look good - just about the same that I'm using. What about the <Files> section you showe at some point - have you also tried without it? I don't use one of those.
Per (and everyone else) I've cracked it. I uninstalled everything to do with Apache and PHP and then reinstalled using YaST. Now it all "just works". Although I've not had time yet to investigate fully, here's what I suspect happened ... For the last 8 months I've been working with Mono, doing a project for my MSc. If you're interested, or suffer from insomnia, you can see the results at: http://www.peredur.uklinux.net When I reinstalled apache2 and php4, YaST complained about some broken dependencies and said that it would have to uninstall mod_mono and subversion. It also had to downgrade a library - although I can't remember which one, now. So I think there was some conflice here, possibly because I used Red Carpet for Mono, rather than YaST. Anyway, the upshot is that it all now works. Thank you very much for taking an interest and providing such a great deal of help. I hope that one day I'll be able to return the favour. Best regards Peter
participants (4)
-
Patrick Shanahan
-
Per Jessen
-
peter
-
Russbucket