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
Woland
Apprentice
Apprentice


Joined: 02 Aug 2002
Posts: 248
Location: Russian Jack, Alaska

PostPosted: Fri Aug 06, 2004 6:10 pm    Post subject: Reply with quote

Addiing apache2 with rc-update should do nothing to apache, it only changes your start up files. I am havind the same problem as you are---"apache2 -D PHP4" works just fine, but "/etc/init.d/apache2 start" starts up apache, but completely ignores PHP. It does pick up ssl, so I know that it is reading the /etc/conf/apache2 file, just pointedly ignoring the -D PHP4. Very frustrating.
_________________
|
|_______________________________________
And some days the Universe just gives you the finger.
Back to top
View user's profile Send private message
eyce
n00b
n00b


Joined: 16 Feb 2003
Posts: 31
Location: Toronto, Canada

PostPosted: Sat Aug 07, 2004 6:46 am    Post subject: This is what I did... Reply with quote

These are the steps that I followed to get my apache2 / php4 working together:
Code:

su

enter password.

Code:

emerge apache
emerge mod_php


Once the emerging is complete
Code:

cd /etc/conf.d
nano apache2

Now edit the line that says "#APACHE2_OPTS="-D SSL" and make it
Code:

APACHE2_OPTS="-D SSL -D PHP4"


Once done, save the file and exit. Then:

Code:

cd /etc/apache2/conf/
cp apache2.conf apache2.conf.bak
nano apache2.conf


Add the following line for PHP4
Code:

LoadModule php4_module  /etc/php/apache2-php4/lib/libphp4.so   

... your path to the libphp4.so file may be different.

If you have a PHP5 installation then add this instead of the above:
Code:

LoadModule php5_module <path to libphp5.so file>


Save and exit the file. And now:

Code:

cd /etc/apache2/conf/
cp commonapache2.conf commonapache2.conf.bak
nano commonapache2.conf


Add the following lines:
Code:

      AddType application/x-httpd-php .php .phtml   
      AddType application/x-httpd-php-source .phps


Save and exit the file. Now test your apache installtion by putting a php file in your htdocs directory (/var/www/<your hostname here>/htdocs) and then:
Code:

apache2 -k start


Open up the browser and type in: http://<your hostname here>/<your php file here>

If you're happy, then let apache start up in ze beginning :):
Code:

rc-update add apache2 default


.. Hope this helps! And I hope I didn't screw up in typing the above up ;). CHeers!
_________________
[img:e670faa8ca]http://vishal.dontexist.com/beast.gif[/img:e670faa8ca]
Back to top
View user's profile Send private message
rjordan
n00b
n00b


Joined: 03 Aug 2004
Posts: 7

PostPosted: Tue Aug 10, 2004 4:13 am    Post subject: BTW Reply with quote

I just wanted to add that APACHE_OPTS is different from APACHE2_OPTS and broke my php when I copied the line off the beginning of this howto.
_________________
Feel free to AIM/E-mail me regarding postings.
Back to top
View user's profile Send private message
Dana Merrick
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jul 2004
Posts: 84
Location: Trinity College

PostPosted: Tue Aug 17, 2004 4:29 pm    Post subject: Re: umm.. it wouldnt start? Reply with quote

theProphecy wrote:
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>

I had the same error that Ladynik0n had, and I changed the SeverName variable in the apache2.conf file but it still doesn't work.
I don't get the same error, but the
Code:
apache2 -k start
fails and I'm not sure why. What exactly should I put as the ServerName? I don't intend on having a domain name for my site, or using it very often (mainly for testing php via my home network and remote access via my computer's IP address).
Back to top
View user's profile Send private message
Woland
Apprentice
Apprentice


Joined: 02 Aug 2002
Posts: 248
Location: Russian Jack, Alaska

PostPosted: Tue Aug 17, 2004 4:52 pm    Post subject: Re: umm.. it wouldnt start? Reply with quote

aragostaragazzo wrote:

I had the same error that Ladynik0n had, and I changed the SeverName variable in the apache2.conf file but it still doesn't work.
I don't get the same error, but the
Code:
apache2 -k start
fails and I'm not sure why. What exactly should I put as the ServerName? I don't intend on having a domain name for my site, or using it very often (mainly for testing php via my home network and remote access via my computer's IP address).



ServerName localhost is the default, and should work fine. May I suggest that your problems lie elsewhere? Check /var/log/apache2 for messages when you try to start.
_________________
|
|_______________________________________
And some days the Universe just gives you the finger.
Back to top
View user's profile Send private message
k:arel
Tux's lil' helper
Tux's lil' helper


Joined: 14 Oct 2003
Posts: 91
Location: Belgium

PostPosted: Tue Aug 17, 2004 4:56 pm    Post subject: Reply with quote

put:
Code:
ServerName localhost

in your httpd.conf file and you won't get an error

it some BIND problem i think
_________________
The fastest way to speed up a Windows machine is at 9.81 meters per second per second.
Back to top
View user's profile Send private message
Woland
Apprentice
Apprentice


Joined: 02 Aug 2002
Posts: 248
Location: Russian Jack, Alaska

PostPosted: Tue Aug 17, 2004 5:01 pm    Post subject: Reply with quote

k:arel wrote:
...
in your httpd.conf file and you won't get an error ...


httpd.conf! Good god man, stop living in the past! It's /etc/apache2/conf/apache2.conf now. Get used to it.
_________________
|
|_______________________________________
And some days the Universe just gives you the finger.
Back to top
View user's profile Send private message
k:arel
Tux's lil' helper
Tux's lil' helper


Joined: 14 Oct 2003
Posts: 91
Location: Belgium

PostPosted: Tue Aug 17, 2004 9:52 pm    Post subject: Reply with quote

Woland wrote:
httpd.conf! Good god man, stop living in the past! It's /etc/apache2/conf/apache2.conf now. Get used to it.


sorry man, i downloaded and installed Apache and PHP from the web
i was just trying to help out
_________________
The fastest way to speed up a Windows machine is at 9.81 meters per second per second.
Back to top
View user's profile Send private message
Dana Merrick
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jul 2004
Posts: 84
Location: Trinity College

PostPosted: Tue Aug 17, 2004 10:28 pm    Post subject: Reply with quote

k:arel wrote:
put:
Code:
ServerName localhost

in your httpd.conf file and you won't get an error

it some BIND problem i think

That's what my apache2.conf file says already.
I know it's not working right because, 1. my bash prompt turns red when a command fails, and 2. there is no instance of apache running afterwards.
I'm not sure what the error is though, because it doesn't say anything.
Any more ideas?
Back to top
View user's profile Send private message
k:arel
Tux's lil' helper
Tux's lil' helper


Joined: 14 Oct 2003
Posts: 91
Location: Belgium

PostPosted: Tue Aug 17, 2004 11:02 pm    Post subject: Reply with quote

aragostaragazzo wrote:

That's what my apache2.conf file says already.
I know it's not working right because, 1. my bash prompt turns red when a command fails, and 2. there is no instance of apache running afterwards.
I'm not sure what the error is though, because it doesn't say anything.
Any more ideas?


try to manually start apache and post the output
if none output: how do you know it isn't working?
are you sure you haven't set the docroot wrong or something like that?
_________________
The fastest way to speed up a Windows machine is at 9.81 meters per second per second.
Back to top
View user's profile Send private message
Dana Merrick
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jul 2004
Posts: 84
Location: Trinity College

PostPosted: Wed Aug 18, 2004 12:07 am    Post subject: Reply with quote

k:arel wrote:
how do you know it isn't working?

There is no output, and your question is answered in my previous post:
aragostaragazzo wrote:
I know it's not working right because, 1. my bash prompt turns red when a command fails, and 2. there is no instance of apache running afterwards.
I'm not sure what the error is though, because it doesn't say anything.

And my docroot is the default (htdocs). I wont even bother changing that till I even get apache to start.
So, uh, any more ideas? :)
Back to top
View user's profile Send private message
Woland
Apprentice
Apprentice


Joined: 02 Aug 2002
Posts: 248
Location: Russian Jack, Alaska

PostPosted: Wed Aug 18, 2004 3:53 am    Post subject: Reply with quote

First, k:arel, you do know I was just kidding, right?

Second, aragostaragazzo, I am assuming that since "your prompt turns red when a command fails" something is being output to stderr or at least apache shoud put something into /var/log/apache2/error_log
perhaps try
Code:
tail -f var/log/apache2/error_log
in one xterm, then try starting apache in another. There should be some kind of output. If there is nothing, then your problems are bigger than configuration, and my advice would be to unmerge apache, and re-install it.
_________________
|
|_______________________________________
And some days the Universe just gives you the finger.
Back to top
View user's profile Send private message
Todd Z
n00b
n00b


Joined: 06 Jul 2004
Posts: 23

PostPosted: Sat Aug 21, 2004 4:19 pm    Post subject: Reply with quote

emerge apache
Calculating dependencies ...done!
>>> emerge (1 of 1) net-www/apache-2.0.50 to /

!!! File is corrupt or incomplete. (Digests do not match)
>>> our recorded digest: 8b251767212aebf41a13128bb70c0b41
>>> your file's digest: 535d5371ea45c84107124b2256872af4
!!! File does not exist: /usr/portage/distfiles//httpd-2.0.50.tar.gz


What does this error mean, and how do i fix it?
_________________
Take out your tux and put on a happy face
Back to top
View user's profile Send private message
Woland
Apprentice
Apprentice


Joined: 02 Aug 2002
Posts: 248
Location: Russian Jack, Alaska

PostPosted: Sat Aug 21, 2004 6:42 pm    Post subject: Reply with quote

Todd, I don't mean to be a pain, but that is something you search the Forums for----it is quite a common error. But, O. K., I'll give you the fix:
Code:

rm /usr/portage/distfiles/httpd-2.0.50.tar.gz
emerge apache
Should do it.
_________________
|
|_______________________________________
And some days the Universe just gives you the finger.
Back to top
View user's profile Send private message
tscolari
l33t
l33t


Joined: 02 May 2004
Posts: 602
Location: curitiba - pr - Brazil

PostPosted: Sun Aug 22, 2004 1:07 pm    Post subject: Reply with quote

Please help me here...

My apache was working ok, until i change the /etc/hostname of my computer.
Now it doesnt, but i dont know how to update this info in apache config, can anyone help me?
this is what i get trying to run apache:

Code:
#/etc/apache2> /etc/init.d/apache2 start
 * Starting apache2...
apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName                                                     [ !! ]
Back to top
View user's profile Send private message
Dana Merrick
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jul 2004
Posts: 84
Location: Trinity College

PostPosted: Sun Aug 22, 2004 1:43 pm    Post subject: Reply with quote

tscolari wrote:
Now it doesnt, but i dont know how to update this info in apache config, can anyone help me?

In your apache2.conf file, uncomment the line that says:
Code:
ServerName localhost

_________________
I'm proud of my life, and the things that I have done,
proud of myself, and the loner I've become.
you're free to whine; it will not get you far,
I do just fine, my car and my guitar.
-Say Anything
Back to top
View user's profile Send private message
newbie_gentoo
Apprentice
Apprentice


Joined: 04 Jul 2004
Posts: 189

PostPosted: Sun Aug 22, 2004 3:48 pm    Post subject: Reply with quote

Thanks for a great tutorial!
Back to top
View user's profile Send private message
tscolari
l33t
l33t


Joined: 02 May 2004
Posts: 602
Location: curitiba - pr - Brazil

PostPosted: Sun Aug 22, 2004 4:28 pm    Post subject: Reply with quote

aragostaragazzo wrote:
tscolari wrote:
Now it doesnt, but i dont know how to update this info in apache config, can anyone help me?

In your apache2.conf file, uncomment the line that says:
Code:
ServerName localhost


I did it, now the message is gone but this still:

* Starting apache2... [ !! ]

anyidea how can i discover what i did to make it stop working?
recently i did some upadates im my system, but the closest of apache was mysql...

maybe if i re-emerge it could get fixed?
Back to top
View user's profile Send private message
Dana Merrick
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jul 2004
Posts: 84
Location: Trinity College

PostPosted: Sun Aug 22, 2004 4:44 pm    Post subject: Reply with quote

tscolari wrote:
I did it, now the message is gone but this still:

* Starting apache2... [ !! ]

anyidea how can i discover what i did to make it stop working?

To be completely honest, I'm still stuck here too. Apache just doesn't want to start on my computer... And I kinda put the webserver on the back burner because I don't really need it, but yes, I share your problem and can't seem to get any further.
I tried re-emerging apache but it didn't do anything helpful. I'm out of ideas...
_________________
I'm proud of my life, and the things that I have done,
proud of myself, and the loner I've become.
you're free to whine; it will not get you far,
I do just fine, my car and my guitar.
-Say Anything
Back to top
View user's profile Send private message
tscolari
l33t
l33t


Joined: 02 May 2004
Posts: 602
Location: curitiba - pr - Brazil

PostPosted: Sun Aug 22, 2004 5:11 pm    Post subject: Reply with quote

aragostaragazzo wrote:

To be completely honest, I'm still stuck here too. Apache just doesn't want to start on my computer... And I kinda put the webserver on the back burner because I don't really need it, but yes, I share your problem and can't seem to get any further.
I tried re-emerging apache but it didn't do anything helpful. I'm out of ideas...


I just dont understand because before it was working
it must be conflicting with some new package that ive updated recently...
but in the few 2 days ive updated a lot of stuff, no way to know what it is now :(

this is the error im getting:

Code:
From error_log
[Sun Aug 22 14:34:07 2004] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "sancho"
Configuration Failed
Back to top
View user's profile Send private message
tscolari
l33t
l33t


Joined: 02 May 2004
Posts: 602
Location: curitiba - pr - Brazil

PostPosted: Sun Aug 22, 2004 6:15 pm    Post subject: Reply with quote

aragostaragazzo wrote:
tscolari wrote:
I did it, now the message is gone but this still:

* Starting apache2... [ !! ]

anyidea how can i discover what i did to make it stop working?

To be completely honest, I'm still stuck here too. Apache just doesn't want to start on my computer... And I kinda put the webserver on the back burner because I don't really need it, but yes, I share your problem and can't seem to get any further.
I tried re-emerging apache but it didn't do anything helpful. I'm out of ideas...


Hey i did it!!
hope it can help you too.

This is what was going wrong here.
First it was working and stoped working after i changed my hostname to othername (before it was tiago-lx now its sancho).

okay.
But i forgot to change it in the /etc/hosts
the first line of it was:

127.0.0.1 localhost tiago-lx

but after i changed it for:

127.0.0.1 localhost sancho

then...

* Starting apache2... [ ok ]

hope it can help you there hehehe
Back to top
View user's profile Send private message
Dana Merrick
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jul 2004
Posts: 84
Location: Trinity College

PostPosted: Sun Aug 22, 2004 6:48 pm    Post subject: Reply with quote

Oh man that fixed it!
As someone who prides himself on figuring out his own errors, I feel really, really dumb. Hehe. :oops:
_________________
I'm proud of my life, and the things that I have done,
proud of myself, and the loner I've become.
you're free to whine; it will not get you far,
I do just fine, my car and my guitar.
-Say Anything
Back to top
View user's profile Send private message
geniux
Veteran
Veteran


Joined: 19 Feb 2004
Posts: 1400
Location: /home

PostPosted: Mon Aug 23, 2004 12:57 am    Post subject: Reply with quote

timvor wrote:
hi all

still cant get php going

links http://localhost and https://localhost gives me the default apache page which is fine , yet http://localhost/test.php gives me

404 Not Found
The requested URL /test.php was not found on this server.

Apache/2.0.48 (Gentoo/Linux) PHP/4.3.3 mod_ssl/2.0.48 OpenSSL/0.9.6k Server at localhost Port 80



/var/log/apache2/error_log shows this after reboot


[Thu Nov 20 13:00:13 2003] [notice] Digest: generating secret for digest authentication ...
[Thu Nov 20 13:00:13 2003] [notice] Digest: done
[Thu Nov 20 13:00:14 2003] [notice] Apache/2.0.48 (Gentoo/Linux) PHP/4.3.3 mod_ssl/2.0.48 OpenSSL/0.9.6k configured -- resuming normal operations
script not found or unable to stat
script not found or unable to stat



I remerged mod_php and apache2 with the following USE flags
USE="pam tcpd ssl sasl libwww mysql imap maildir apache apache2 "

the file seems to be there

root@esnet / # ls -al /var/www/localhost
total 28
drwxr-xr-x 6 root root 4096 Nov 20 08:40 .
drwxr-xr-x 3 root root 4096 Nov 19 14:04 ..
drwxr-xr-x 2 root root 4096 Nov 19 14:04 cgi-bin
drwxr-xr-x 3 root root 4096 Nov 19 14:04 error
drwxr-xr-x 3 root root 4096 Nov 20 11:57 htdocs
drwxr-xr-x 3 root root 4096 Nov 19 14:04 icons
-rw-r--r-- 1 root root 21 Nov 20 08:40 test.php


The required file is there so why can i not get to it or does this mean that php is not working ?????


Any help herereally appreciated

timvor

I dont have test.php
Code:

 # ls -la /var/www/localhost       
total 24
drwxr-xr-x  6 root root 4096 Aug 24 01:10 .
drwxr-xr-x  3 root root 4096 Aug 24 01:10 ..
drwxr-xr-x  2 root root 4096 Aug 24 01:10 cgi-bin
drwxr-xr-x  3 root root 4096 Aug 24 01:10 error
drwxr-xr-x  3 root root 4096 Aug 24 02:33 htdocs
drwxr-xr-x  3 root root 4096 Aug 24 01:10 icons

And Mozilla claims that it can't open unknown file (.php) if I put my index.php in htdocs. What's the error, I've followed the guide step by step and it all works beside the php probs.
Can anyone help, I'm totally stucked and dont know what to do.
TIA
_________________
AMD Athlon64 X2 4200+ AM2
MSI K9N SLI Platinum, Enermax Liberty 500W
1GB RAM Crucial DDR2 667MHz, MSI nVidia 7600GS 256MB
400GB + 250GB Samsung SATAII HDD
Gentoo - BeyondSources 2.6.19-20
Back to top
View user's profile Send private message
Dana Merrick
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jul 2004
Posts: 84
Location: Trinity College

PostPosted: Mon Aug 23, 2004 1:39 am    Post subject: Reply with quote

geniux wrote:
Mozilla claims that it can't open unknown file (.php) if I put my index.php in htdocs

That sounds like your server doesn't have the appropriate MIME types set correctly.
Make sure that you put the following in /etc/apache2/conf/commonapache2.conf:
Code:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

_________________
I'm proud of my life, and the things that I have done,
proud of myself, and the loner I've become.
you're free to whine; it will not get you far,
I do just fine, my car and my guitar.
-Say Anything
Back to top
View user's profile Send private message
geniux
Veteran
Veteran


Joined: 19 Feb 2004
Posts: 1400
Location: /home

PostPosted: Mon Aug 23, 2004 2:18 am    Post subject: Reply with quote

Thanks, I had missed the last line, but now it can read my php files.
But I cant for my life get the manual to work, anything you can help me with?
Sorry for all the questions, but it's the first time I ever try apache. I want to put my website on my computor because of bandwith troubles and such, but it turned out to be alot harder than I could imagine.
_________________
AMD Athlon64 X2 4200+ AM2
MSI K9N SLI Platinum, Enermax Liberty 500W
1GB RAM Crucial DDR2 667MHz, MSI nVidia 7600GS 256MB
400GB + 250GB Samsung SATAII HDD
Gentoo - BeyondSources 2.6.19-20
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 3 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