Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problem with PHP and Apache
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
tony_yum
n00b
n00b


Joined: 20 Feb 2005
Posts: 12
Location: UK

PostPosted: Sun Feb 20, 2005 8:45 pm    Post subject: Problem with PHP and Apache Reply with quote

Hi. I've recently done
Code:
emerge --newuse apache mod_php
with php in the USE flag. I have
Code:
APACHE2_OPTS="-D PHP4"
in /etc/conf.d/apache2 and

Code:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

LoadModule php4_module /usr/lib/apache2-extramodules/libphp4.so


in /etc/apache2/conf/apache2.conf

I restarted apache2, and try accessing info.php from the web browser which has the following

Code:
<html>
<body><?php phpinfo(); ?></body>
</html>


And the web browser display exactly that code. Apache doesn't seemed to have parsed the PHP code.

Is there some steps that I have missed?


Thanx in advance.
_________________
Tony Yum ( places to go out http://www.revmap.com )
Back to top
View user's profile Send private message
TheRAt
Veteran
Veteran


Joined: 03 Jun 2002
Posts: 1580

PostPosted: Sun Feb 20, 2005 8:56 pm    Post subject: Reply with quote

You are certain you have emerged PHP4, not 5... your config file enables 4..
_________________
All reality is the construct of the observer.

Get Firefox and rediscover the web!

BOFH Excuse #295:
The Token fell out of the ring. Call us when you find it.
Back to top
View user's profile Send private message
markp2000
n00b
n00b


Joined: 30 Oct 2004
Posts: 41

PostPosted: Mon Feb 21, 2005 6:49 am    Post subject: Reply with quote

I don't know if the addtype goes in the /etc/conf.d/apahce2 file. I have mine in the /etc/apache2/conf/commonapache2.conf file.

Mark
Back to top
View user's profile Send private message
nobspangle
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1318
Location: Manchester, UK

PostPosted: Mon Feb 21, 2005 8:14 am    Post subject: Reply with quote

The addtype and loadmodule simply go in the apache config file it doesn't matter where. However gentoo have provided us with a nice simple way of doing things.

In /etc/apache2/conf/modules.d are several files depending on what extra modules you have installed and what options you compiled apache with, the apache config automatically includes all of these files into the config. If you look in the file 70_mod_php.conf you will see the line <IfDefine PHP4> this means if you start apache with the option -D PHP4 it will include this file in the config. This means you do not have to edit your config files to get php to work you only need to add the -D PHP4 to APACHE2_OPTS in /etc/conf.d/apache2

So in short you have not missed any steps, you have performed too many.
Back to top
View user's profile Send private message
DarkStorm_Inc
Tux's lil' helper
Tux's lil' helper


Joined: 07 Feb 2005
Posts: 105
Location: The Ether

PostPosted: Tue Feb 22, 2005 12:25 am    Post subject: Reply with quote

noob, even w/o the extra steps of adding to the conf it still doesnt work. I have php4 apache2 installed and it doesnt work as you have described... gentoo was nice to do that.. but it doesnt work well imo. Installing a std apache install w/o all the gentoo extras would be better. At least that cant be blamed on gentoo not working right during emerge...
Back to top
View user's profile Send private message
lookinin
Guru
Guru


Joined: 21 Jan 2005
Posts: 486

PostPosted: Tue Feb 22, 2005 1:14 am    Post subject: Reply with quote

tony_yum: Have you gotten anywhere with this?

DarkStorm_Inc: Your problem is identical to tony_yum's?

Quote:
Hi. I've recently done
Code:
emerge --newuse apache mod_php
with php in the USE flag


Just a note: apache doesn't care if php is in your use flags

Code:
# emerge -pv apache mod_php

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] net-www/apache-2.0.52-r1  +berkdb -debug -doc +gdbm +ipv6 -ldap +ssl -static -threads 0 kB
[ebuild   R   ] dev-php/mod_php-4.3.10  -X +apache2 +berkdb +crypt -curl -debug -doc -fdftk -firebird -flash -freetds -gd -gd-external +gdbm -gmp -hardenedphp -imap -informix +ipv6 -java -jpeg -kerberos -ldap -mcal -memlimit -mssql +mysql +nls -oci8 -odbc +pam -pdflib -png -postgres -qt -snmp +spell +ssl +tiff +truetype +xml2 -yaz 0 kB


Quote:
Code:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

LoadModule php4_module /usr/lib/apache2-extramodules/libphp4.so


in /etc/apache2/conf/apache2.conf


As nobspangle mentioned, these settings should all ready exist in /etc/apache2/conf/modules.d/70_mod_php.conf, so there is no need to add them otherwise. Check that this file exists.

And to be thorough, I would remove the lines you said you added to /etc/apache2/conf/apache2.conf.

There is only one config file that needs a change - and that is in /etc/conf.d/apache2 (again, as all ready mentioned):
Code:
APACHE2_OPTS="-D PHP4"


I apologize if I sound rude, but I want to make sure that point is clear. Moving along - have you guys both checked your versions, remerged, etc? What is the output of:

Code:
# qpkg -v -I apache
# qpkg -v -I mod_php


Have you looked at your logs in /var/log/apache2/error_log? Mine has output like the following:

Code:
[Mon Feb 21 19:54:32 2005] [notice] Apache/2.0.52 (Gentoo/Linux) PHP/4.3.10 configured -- resuming normal operations
Back to top
View user's profile Send private message
mmschnei
Tux's lil' helper
Tux's lil' helper


Joined: 17 Aug 2004
Posts: 107
Location: Purdue University

PostPosted: Sat Feb 26, 2005 6:56 am    Post subject: Reply with quote

This might be a stupid suggestion but after adding "-D PHP4" to /etc/conf.d/apache2 have you restarted your apache server?
_________________
Matt Schneider
Materials Engineering Student
Purdue University
West Lafayette, Indiana, USA

malaeum@gmail.com
matt@pascs.com
system specs: http://malaeum.net/system
Back to top
View user's profile Send private message
j-m
Retired Dev
Retired Dev


Joined: 31 Oct 2004
Posts: 975

PostPosted: Sat Feb 26, 2005 11:52 am    Post subject: Re: Problem with PHP and Apache Reply with quote

tony_yum wrote:

Code:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

LoadModule php4_module /usr/lib/apache2-extramodules/libphp4.so


in /etc/apache2/conf/apache2.conf


Uhm, why are you doing this, all of this and more is in /etc/apache2/modules.d/70_mod_php.conf :?:
Back to top
View user's profile Send private message
truth_bk
n00b
n00b


Joined: 15 Oct 2004
Posts: 13

PostPosted: Sat Feb 26, 2005 12:24 pm    Post subject: php files in document root? Reply with quote

I have a feeling some of these guys might actually be opening the files straight up on the web broswer.... I dont mean to insult anyone's intelligence, and this might just be me supposing things I shouldn't.... but hey, I saw no one mentioned it above. You have to make sure these php files are "served" by the apache server. You have to make sure you put these in the document root: /var/www/localhost/htdocs (by default) before you open them in your browser!! Make sure you do this, it's the webserver that runs the php code, NOT your broswer.

Anyway, if you do know this, as you might, don't feel insulted by this suggestion! :)
Back to top
View user's profile Send private message
RikBlankestijn
Guru
Guru


Joined: 01 May 2003
Posts: 315
Location: Arnhem the Netherlands

PostPosted: Sat Feb 26, 2005 11:47 pm    Post subject: Reply with quote

I had to add apache2 to the USE-flags, and then after re-emerging mod_php. I did:
Quote:
* To have Apache run php programs, please do the following:
* Edit /etc/conf.d/apache2 and add "-D PHP4" to APACHE2_OPTS
* This is a CHANGE from previous behavior, which was "-D PHP"
* This is for the upcoming PHP5 support. The ebuild will attempt
* to make this update between PHP and PHP4 automatically


Thanks lookinin.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum