Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
apache2 with php and mod_php does not work
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
Roxxor
Apprentice
Apprentice


Joined: 04 Jun 2003
Posts: 225
Location: Stockholm, Sweden

PostPosted: Tue May 17, 2005 2:49 pm    Post subject: apache2 with php and mod_php does not work Reply with quote

EDIT:

I installed another version (apache 2.0.54) and it worked.

But a new problem:

I emerged php and mod_php and added -D PHP4 in the /etc/conf.d/apache file.

I created a <?php phpinfo(); ?> file (with extension .php) in my /var/www/localhost/htdocs directory.

But the php file still doesn´t work.

Please help!


Last edited by Roxxor on Tue May 17, 2005 6:32 pm; edited 3 times in total
Back to top
View user's profile Send private message
Blubbmon
Apprentice
Apprentice


Joined: 13 Feb 2004
Posts: 156
Location: Germany, Potsdam

PostPosted: Tue May 17, 2005 6:10 pm    Post subject: Reply with quote

You should have a look in /var/log/apache2/error_log.

BTW: Your startup command should be "/etc/init.d/apache2 start" :)
Back to top
View user's profile Send private message
Roxxor
Apprentice
Apprentice


Joined: 04 Jun 2003
Posts: 225
Location: Stockholm, Sweden

PostPosted: Tue May 17, 2005 6:30 pm    Post subject: Reply with quote

Blubbmon wrote:
You should have a look in /var/log/apache2/error_log.

BTW: Your startup command should be "/etc/init.d/apache2 start" :)


I installed another version (apache 2.0.54) and it worked.

But a new problem:

I emerged php and mod_php and added -D PHP4 in the /etc/conf.d/apache file.

I created a <?php phpinfo(); ?> file (with extension .php) in my /var/www/localhost/htdocs directory.

But the php file still doesn´t work.

Please help!
Back to top
View user's profile Send private message
stoker
n00b
n00b


Joined: 13 May 2005
Posts: 28
Location: Williston, Vermont

PostPosted: Tue May 17, 2005 9:10 pm    Post subject: Reply with quote

Roxxor wrote:
Blubbmon wrote:
You should have a look in /var/log/apache2/error_log.

BTW: Your startup command should be "/etc/init.d/apache2 start" :)


I installed another version (apache 2.0.54) and it worked.

But a new problem:

I emerged php and mod_php and added -D PHP4 in the /etc/conf.d/apache file.

I created a <?php phpinfo(); ?> file (with extension .php) in my /var/www/localhost/htdocs directory.

But the php file still doesn´t work.

Please help!


can you explain a little better what you mean by 'the php file still doesn't work?" I'm assuming here that you can hit your web server with Firefox or whatever, but what is the output you see when you try to load your php file? have you checked your log files for any error messages? (please paste any possible error messages in your next email, it'll help us tell you what's wrong)

if you see the code itself as text, you probably don't have the php extensions mapped to PHP in your httpd.conf. if this isn't the problem, please be a little more specific.

thx -
_________________
Check out my current Gentoo and FreeBSD projects at http://www.mattstorer.net
Back to top
View user's profile Send private message
fidel
Guru
Guru


Joined: 16 Jul 2004
Posts: 407
Location: CH

PostPosted: Wed May 18, 2005 7:49 am    Post subject: Reply with quote

I used to have this problem as well! Have you checked, that the file in

/etc/apache2/modules.d/70_mod_php4/5(whatever version..).conf

is linked to

/etc/apache2/conf/modules.d/70_mod_php4/5.conf

??

otherwise:
Code:
#ln -sf /etc/apache2/modules.d/70_mod_php5.conf /etc/apache2/conf/modules.d/70_mod_php5.conf

?? maybe that helps?

Did you edit
/etc/conf.d/apache2

and add something like

Code:
APACHE2_OPTS="-D SSL -D PHP5"

?
Back to top
View user's profile Send private message
xgregx
Apprentice
Apprentice


Joined: 17 Dec 2004
Posts: 181
Location: Cheshire, CT

PostPosted: Wed May 18, 2005 6:12 pm    Post subject: Reply with quote

Make sure you add the MIME type to the apache configuration. If it's displaying the actual PHP code instead of the html output, then apache doesn't know it's supposed to execute it. Search the forums, this problem happens very often.
_________________
Half-life/Source/Urban Terror/Unreal control panel -> www.opengamepanel.org
Linux user #347899
Gentoo has USE flags for a highly configurable system.
Microsoft has SUE flags to stifle innovation
Back to top
View user's profile Send private message
Featherfoot
Veteran
Veteran


Joined: 28 Dec 2002
Posts: 1108
Location: Stuart, Florida

PostPosted: Thu May 19, 2005 3:20 am    Post subject: Reply with quote

I have the same problem with apache-2.0.54 and mod_php-4.3.11-r2
: My system asks me whether I want to save the .php file or execute it. It is pretty clear that it doesn't recognize the mime type.

Here is the relevant section in my /etc/conf.d/apache2 file:
Code:

#This means that the mod_ssl.so DSO module is only loaded
# into the server when you pass "-D SSL" at startup.  To
# enable WebDAV, add "-D DAV -D DAV_FS".  If you installed
# mod_php then add "-D PHP4".  For more options, please
# read the files in the /etc/apache2/conf/modules.d directory.

APACHE2_OPTS="-D SSL -D DOC -D PHP4"


Just for laughs I added some errors into /etc/apache2/conf/modules.d/70_mod_php.conf as follows:

Code:

# vim: ft=apache sw=4 ts=4
<IfDefine PHP4>
        JC1
        # Load the module first
        <IfModule !sapi_apache2.c>
                JC2
                LoadModule php4_module    extramodules/libphp4.so
        </IfModule>

        # Set it to handle the files
        <IfModule mod_mime.c>
                JC3
                AddType application/x-httpd-php .php
                AddType application/x-httpd-php .phtml
                AddType application/x-httpd-php .php3
                AddType application/x-httpd-php .php4
                AddType application/x-httpd-php-source .phps
        </IfModule>

        # Fix some bugs
        <Files *.php>
                # keep this the same size as post_max_size in php.ini
                # LimitRequestBody 8388608
        </Files>
        <Files *.php3>
                # keep this the same size as post_max_size in php.ini
                # LimitRequestBody 8388608
        </Files>
        <Files *.php4>
                # keep this the same size as post_max_size in php.ini
                # LimitRequestBody 8388608
        </Files>
        <Files *.phps>
                # keep this the same size as post_max_size in php.ini
                # LimitRequestBody 8388608
        </Files>
        <Files *.phtml>
                # keep this the same size as post_max_size in php.ini
                # LimitRequestBody 8388608
        </Files>

</IfDefine>


I get errors and can progressively remove the JC1 JC2 and JC3 lines to make the errors go away.

What am I doing wrong?
Back to top
View user's profile Send private message
xgregx
Apprentice
Apprentice


Joined: 17 Dec 2004
Posts: 181
Location: Cheshire, CT

PostPosted: Thu May 19, 2005 3:42 am    Post subject: Reply with quote

You should only have to edit the /etc/apache2/commonapache.conf or apache.conf. I never had to edit the file you mentioned.
_________________
Half-life/Source/Urban Terror/Unreal control panel -> www.opengamepanel.org
Linux user #347899
Gentoo has USE flags for a highly configurable system.
Microsoft has SUE flags to stifle innovation
Back to top
View user's profile Send private message
Mord
n00b
n00b


Joined: 09 Jan 2003
Posts: 68
Location: Where the rubber meets the road.

PostPosted: Thu May 19, 2005 3:46 am    Post subject: Reply with quote

GRRR I had the same problem, and after working on it for over an hour, launched my site in Internet Explorer and noticed that it worked just fine. Cleared the cache in Firefox and problem went away.....
_________________
I feel more like I do now than I did when I got here.
Back to top
View user's profile Send private message
Featherfoot
Veteran
Veteran


Joined: 28 Dec 2002
Posts: 1108
Location: Stuart, Florida

PostPosted: Thu May 19, 2005 11:32 pm    Post subject: Reply with quote

Hmm....

Same thing happened here. Hurrah!
Back to top
View user's profile Send private message
misc
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2003
Posts: 109

PostPosted: Sat May 28, 2005 3:28 am    Post subject: Reply with quote

Mord, thankyou for that! I only wasted half an hour until I came across this post and tried on another browser and it worked fine!
Back to top
View user's profile Send private message
stoker
n00b
n00b


Joined: 13 May 2005
Posts: 28
Location: Williston, Vermont

PostPosted: Sat May 28, 2005 4:00 am    Post subject: Reply with quote

so, what, is this an error on the client side or the server side? my guess is that, based on what Mord et al are now saying, is that it's a client-side issue. sooo.... WTF? there's still an issue here, soo ... is ... this ... resolved?

now that you mention it I seem to remember having similar issues a ways back serving PHP from my FreeBSD box.. there was something I did to fix the problem... had something, maybe, to do with clearing the cache and temprary files? forget, it was a long time ago.

anyway, glad to hear the problem's been reduced to the level of annoyance-only.
_________________
Check out my current Gentoo and FreeBSD projects at http://www.mattstorer.net
Back to top
View user's profile Send private message
Mondo1287
n00b
n00b


Joined: 26 Apr 2005
Posts: 16

PostPosted: Tue Jun 07, 2005 4:05 pm    Post subject: Reply with quote

I had the same problem for the last couple of days, apache wasn't loading libphp4.so at all. I moved the 70_mod_php.conf from /etc/apache2/conf/modules.d to /etc/apache2/modules.d and Apache did load libphp4.so If you look in the error log you should see Apache/2.0.54 (Gentoo/Linux) PHP/4.3.11 configured -- resuming normal operations

Then Apache was segfaulting when any page was acessed with libphp4.so loaded. I then unmerged mod_php and emerged it again and then it started working.
Back to top
View user's profile Send private message
chovy
Guru
Guru


Joined: 03 Dec 2004
Posts: 453

PostPosted: Wed Jun 15, 2005 6:29 am    Post subject: Reply with quote

clearing the cache worked for me.
_________________
Woof, Woof! Add "[solved]" to the title! Woof, Woof!
Back to top
View user's profile Send private message
DaviXX
n00b
n00b


Joined: 06 May 2005
Posts: 46

PostPosted: Wed Jun 15, 2005 6:36 am    Post subject: Reply with quote

Hi,

after merging mod_php, a message ask you for launch :

"ebuild [...] config"

this add the necessary lines to apache conf.

so re-emerge mod_php and be aware of the messages at the end of merge.
_________________
David CHANIAL
sdfrance.com - Location de serveurs dédiés infogérés
Serveurs sous Gentoo/Linux
Back to top
View user's profile Send private message
chovy
Guru
Guru


Joined: 03 Dec 2004
Posts: 453

PostPosted: Wed Jun 15, 2005 7:14 am    Post subject: Reply with quote

I just emerged php-4.3.11, apache2, then mod_php-4.3.11.

Only thing I had to do was setup /etc/apache2/httpd.conf (ServerName, basic stuff, etc).

And to get mod_php to work, just add the following to /etc/conf.d/apache2

APACHE2_OPTS="-D SSL -D PHP4"

Then reboot "/etc/init.d/apache2 restart".

Clear cache, restart browser, then test it.
_________________
Woof, Woof! Add "[solved]" to the title! Woof, Woof!
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