Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Installing Apache2 with PHP5.x (incl. old Apache+PHP4.x)
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6  Next  
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
cmassa
n00b
n00b


Joined: 03 Jan 2004
Posts: 44
Location: seattle

PostPosted: Sun Jan 04, 2004 8:30 am    Post subject: Reply with quote

this was definitely the easiest apache installation ive ever done, but also the most perplexing. emerge is cool, but i was lost without apachectl and httpd.conf.

thanks to all for adding to this!
Back to top
View user's profile Send private message
Lohman
n00b
n00b


Joined: 10 Nov 2003
Posts: 7

PostPosted: Tue Jan 06, 2004 6:34 pm    Post subject: Reply with quote

"Warning: module_php4 already loaded ignoring"

I eliminated that message by not adding the LoadModule php4 to the apache2.conf. The -D PHP4 in the conf.d/apache2 apparently causes it to load PHP before it even reads the .conf file which is why it states that when it reads the LoadModule php4 in the conf.
Back to top
View user's profile Send private message
dreamwolf
n00b
n00b


Joined: 22 May 2002
Posts: 17
Location: Mount Laurel, NJ, USA

PostPosted: Wed Jan 07, 2004 12:01 am    Post subject: php, mod_php, php_in_a_hat, eggs_php_spam_bacon Reply with quote

Oopsz wrote:
php is useful for shell scripting and cgi-php, mod_php is the persistent php environment for apache. Similar for perl vs mod_perl.

Oh, the hours I've wasted!

This has messed me up twice (though the second time I spent significantly less time trying to figure out what I did wrong ;). I would be willing to bet that the vast majority of people who need PHP expect to use it as a web scripting language. Wouldn't it've made more sense to have "php" be the Apache plug-in and "cli_php" or "php_shell" (or something similar) be the command line version?

dreamwolf
Back to top
View user's profile Send private message
Slammer
Bodhisattva
Bodhisattva


Joined: 28 Mar 2003
Posts: 270
Location: Greece

PostPosted: Tue Feb 03, 2004 10:38 am    Post subject: Reply with quote

I have installed apache2 and mod_php. Apache loads the php module successfully but when I try to load this index.htm file:

Code:

<?php
phpinfo();
?>
Testing....


I get only "Testing...".

PHP does not work.... No error messages in apache log....
_________________
Keep Slamming...
Back to top
View user's profile Send private message
valuial
Tux's lil' helper
Tux's lil' helper


Joined: 03 Feb 2004
Posts: 85

PostPosted: Wed Feb 04, 2004 2:14 pm    Post subject: Reply with quote

You need to name it index.php, not index.htm

with the extension htm apache tries to interpret it without php-interpretation...

Ps: Sorry for my bad english...

Edit: Apache doesnt interpret at all, the browser gets the raw file, and interprets the
Code:

<?
PHPcode-here
?>


as unrekognised HTML-Tag and ignores it.
Back to top
View user's profile Send private message
Slammer
Bodhisattva
Bodhisattva


Joined: 28 Mar 2003
Posts: 270
Location: Greece

PostPosted: Wed Feb 04, 2004 6:10 pm    Post subject: Reply with quote

After renaming to .php everything is OK.
Solved! Thanks!
_________________
Keep Slamming...
Back to top
View user's profile Send private message
dmak
n00b
n00b


Joined: 09 Feb 2004
Posts: 6

PostPosted: Mon Mar 01, 2004 5:28 pm    Post subject: Reply with quote

i tried to emerge php mod_php
and it says something about unable to download couple packages and was aborted. I think the package that emerge get isn't there anymore how can i get emerge to download the needed packages.

-dmak
Back to top
View user's profile Send private message
0paque
n00b
n00b


Joined: 26 Feb 2004
Posts: 1

PostPosted: Mon Mar 01, 2004 9:40 pm    Post subject: Reply with quote

I tried the following:

Code:
# emerge -p apache php mod_php > /tmp/1


Then
Code:
# emerge -p apache mod_php > /tmp/2


Then:
Code:
# diff 1 2


The only difference in the two emerge's is the order in which mod_php and php gets installed. So you can use either command and come out with the same result.
Back to top
View user's profile Send private message
Sanderfox
Tux's lil' helper
Tux's lil' helper


Joined: 08 Apr 2004
Posts: 101

PostPosted: Tue Apr 20, 2004 4:19 pm    Post subject: Reply with quote

I used this howto to get apache working with php, and it's almost working I think. The only thing that isn't right, is that if I want to go to a directory on my webserver (from the internet, not local) with an index.php file in it, I get the downloadmanager up asking me if I want to open or save.
Does any one have a solution for this problem ?
Back to top
View user's profile Send private message
Ladynik0n
Tux's lil' helper
Tux's lil' helper


Joined: 12 Apr 2004
Posts: 75

PostPosted: Sun Jun 06, 2004 8:51 am    Post subject: umm.. it wouldnt start? Reply with quote

Code:

apache2 -k start

apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName


what does this mean?
Back to top
View user's profile Send private message
theProphecy
n00b
n00b


Joined: 29 Oct 2003
Posts: 50
Location: Denmark, Århus-->Åbyhøj

PostPosted: Fri Jun 25, 2004 6:36 pm    Post subject: Re: umm.. it wouldnt start? Reply with quote

Ladynik0n wrote:
Code:

apache2 -k start

apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName


what does this mean?

I eliminated this by editing the apache2.conf file:
Code:

# nano -w /etc/apache2/conf/apache2.conf
// Find the line saying #ServerName localhost and uncomment:
ServerName <a_name_of_your_choise>

_________________
Michael Dahl
theprophecy software
innovations make the future
Back to top
View user's profile Send private message
Lajasha
Veteran
Veteran


Joined: 17 Mar 2004
Posts: 1040
Location: Vibe Central

PostPosted: Fri Jun 25, 2004 6:48 pm    Post subject: Reply with quote

Sanderfox wrote:
I used this howto to get apache working with php, and it's almost working I think. The only thing that isn't right, is that if I want to go to a directory on my webserver (from the internet, not local) with an index.php file in it, I get the downloadmanager up asking me if I want to open or save.
Does any one have a solution for this problem ?

If you do it local does it do the same, or does it work like it should?
Make sure that you have the following information in your /etc/apache2/conf/apache2.conf
Code:
LoadModule php4_module /usr/lib/apache2-extramodules/libphp4.so


and in /etc/apache2/conf/commonapache2.conf
Code:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

_________________
Come and play in my land
Back to top
View user's profile Send private message
neomatrix35
n00b
n00b


Joined: 05 Jul 2004
Posts: 53

PostPosted: Tue Jul 06, 2004 10:17 pm    Post subject: Reply with quote

to get apache to load with a index.php you need to add it to the config file. theres a line that has "index.html, index.htm, index.shtml... and so on"... just add index.php to that and you'll have no problems
Back to top
View user's profile Send private message
sk93
n00b
n00b


Joined: 07 Jul 2004
Posts: 7

PostPosted: Sun Jul 11, 2004 9:41 pm    Post subject: Reply with quote

just wanted to say thanks for the guide.

I've been messing around with apache / php /mysql all weekend, and this is the first, up to date, guide that got everything working first time.

Nicely done :)
Back to top
View user's profile Send private message
theProphecy
n00b
n00b


Joined: 29 Oct 2003
Posts: 50
Location: Denmark, Århus-->Åbyhøj

PostPosted: Tue Jul 13, 2004 1:11 am    Post subject: Reply with quote

Quote:

o get apache to load with a index.php you need to add it to the config file. theres a line that has "index.html, index.htm, index.shtml... and so on"... just add index.php to that and you'll have no problems

The specific configuration point for this is:
Code:

<IfModule mod_dir.c>
    DirectoryIndex index.php
</IfModule>

I don't remeber exactly which configuration file this is located in (ripped this from my Win Box with Apache1.x). But as far as i remember the syntax should be exactly the same in Apache2.x.

(btw. im using Apache1.x, because I where having some very wierd problems with Apache2 and PHP/Regular Expressions, resulting in Apache crashing. The wierd thing is that the exact same code doesn't have a problem running with the exact same PHP installation but in Apache1.x. Anyways, thanks to everybody contributing to this guide/help. :D )[/quote]
_________________
Michael Dahl
theprophecy software
innovations make the future
Back to top
View user's profile Send private message
neomatrix35
n00b
n00b


Joined: 05 Jul 2004
Posts: 53

PostPosted: Tue Jul 13, 2004 3:01 am    Post subject: Reply with quote

what is ur problem?
Back to top
View user's profile Send private message
theProphecy
n00b
n00b


Joined: 29 Oct 2003
Posts: 50
Location: Denmark, Århus-->Åbyhøj

PostPosted: Tue Jul 13, 2004 11:41 am    Post subject: Reply with quote

Well have no problem now that im running Apache 1.x, but as I said, I had a problem with PHP and Apache 2, doing some very strange errors in regular expressions. The wierd thing, was that it made no sence about when the error occured.
I had a piece of code, which when being runned would make apache crash. Then to determine what caused the crash, i made some replicas of the script (simpler versions of the regular expression), and found out that when I systematically executed specific pieces of code (the simpler versions of the regular expression), then "building" my way back up to the original script. And after doing all this "building up", I could one or two times execute the script that earlier crashed apache, but only one or two times, then it started crashing apache again.
The funny thing is that the simpler scripts were cut back versions of the "big" one that made apache crash. And the correct order to execute them (in order to get the "big" one running a couple of times), was with the most cut back one, first, and then the next most simple cut back one and so on, until all the simpler versions had been executed. Very strange.
Unfortunately (spelling? :P) im not sure if I have the script anymore, might have it, but not 100% sure it's the same. (I might have further developed on it since).

I also checked the same script on other serves running Apache 1.x, and there were no problems at all, so I thought it might be Apache 2.x, and therefor I installed it on my machine, not changing anything else (even not the PHP installation), and that made the trick. (or it might just be because I used my laptop running Windows as server, hehe.)
_________________
Michael Dahl
theprophecy software
innovations make the future
Back to top
View user's profile Send private message
neomatrix35
n00b
n00b


Joined: 05 Jul 2004
Posts: 53

PostPosted: Tue Jul 13, 2004 1:03 pm    Post subject: Reply with quote

wow... i have no clue... never heard of a script crashing an apache server before....i mean non-malicious anyways.... sorry dude.... but if try to install apache2 on gentoo... it might work.. never know
Back to top
View user's profile Send private message
theProphecy
n00b
n00b


Joined: 29 Oct 2003
Posts: 50
Location: Denmark, Århus-->Åbyhøj

PostPosted: Tue Jul 13, 2004 1:06 pm    Post subject: Reply with quote

Well thanks anyways. :)

It mights, but really no big problem, since Apache 1.x solved the problem. And since most webhosts run apache 1.x, its not that big of a deal, programming on the same version. :) And I like having everything with me around on my laptop (developing server, source code etc.) so it has to be on it.
_________________
Michael Dahl
theprophecy software
innovations make the future
Back to top
View user's profile Send private message
DaRkNeS
n00b
n00b


Joined: 26 May 2003
Posts: 18
Location: Italy

PostPosted: Fri Jul 16, 2004 3:52 pm    Post subject: Reply with quote

I have a little problem... When i point my browser to the webserver:

Warning: Unknown(/var/www/localhost/htdocs/default.php): failed to open stream: Permission denied in Unknown on line 0

Warning: (null)(): Failed opening '/var/www/localhost/htdocs/default.php' for inclusion (include_path='.:/usr/lib/php') in Unknown on line 0

In the php page there's the phpinfo function BUT phpbb work well... maybe something wrong with php includes. Any solution?


Excuse me for my english :D
Back to top
View user's profile Send private message
tehnomage
n00b
n00b


Joined: 04 Jun 2004
Posts: 10

PostPosted: Mon Jul 26, 2004 9:46 am    Post subject: Reply with quote

I seem to have the exact same problem, and please note that before what ever happend ( I think some upgrade ocurred) I had a nice php app fully working.
Back to top
View user's profile Send private message
tehnomage
n00b
n00b


Joined: 04 Jun 2004
Posts: 10

PostPosted: Mon Jul 26, 2004 9:52 am    Post subject: Reply with quote

Ok, this is how I solved it, I set the perms for /var/www/ to 755 and the user:group to root:root. Note that the doc roots for my vhosts are in the form : /var/www/host/so_on.

Hope it helps.
Back to top
View user's profile Send private message
DaRkNeS
n00b
n00b


Joined: 26 May 2003
Posts: 18
Location: Italy

PostPosted: Mon Jul 26, 2004 5:46 pm    Post subject: Reply with quote

it works, thanks :D
BUT it's safe to give 755 to this directory? :?
Back to top
View user's profile Send private message
Gentist
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 247

PostPosted: Mon Jul 26, 2004 6:11 pm    Post subject: Reply with quote

I have a problem with mod_php, it doesn't load with apache, despite the fact that I edited /etc/conf.d/apache2 and added:
Code:
APACHE2_OPTS="-D SSL -D PHP4"

It doesn't give me any error message either, and the error log doesn't say anything about it. However, starting Apache with "apache2 -D PHP4" works fine.

I installed apache and php on the computer for development and testing purposes, so that I would be able to test my scripts in a real world environment without going online, thus I did not add apache with "rc-update add apache2 default".

Did I miss something?
Back to top
View user's profile Send private message
tehnomage
n00b
n00b


Joined: 04 Jun 2004
Posts: 10

PostPosted: Mon Jul 26, 2004 10:50 pm    Post subject: Reply with quote

yeah, it is ok. if you wanna be paranoid, you can set it to 555 and root:root, so it should be readable and accessable by anyone and be owned by root only, but not writeable even by root ( from a shell obtained by exploiting some vuln, for example).
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
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 2 of 6

 
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