View previous topic :: View next topic |
Author |
Message |
khel Tux's lil' helper
Joined: 07 Mar 2003 Posts: 80
|
Posted: Fri Mar 07, 2003 5:45 am Post subject: Web Server How-To (Apache2 + mod_php + mysql) |
|
|
I couldn't find any step-by-step instructions on setting up a webserver, so, after lurking on this forum for a while, I decided to share my experience on the subject. Anyway, to make the long story short, that's what I did to make Apache2/mod_php/mysql combo work to suite my needs
edit /etc/make.conf and add
ACCEPT_KEYWORDS="~x86"
USE="-X -gtk -gnome -alsa -qt -qtmt -pdflib mysql apache2 pam ssl"
and don't forget to run env-update after changing the make.conf
emerge mysql
rc-update add mysqld default
emerge netpbm (image manipulation package required by Gallery)
emerge apache
rc-update add apache2 default
then
emerge mod_php
emerge clean
edit /etc/conf.d/apache2 and add this line
APACHE_OPTS="-D SSL -D PHP4"
edit /etc/apache2/conf/apache2.conf and add this line
LoadModule php4_module /usr/lib/apache2-extramodules/libphp4.so
then restart apache
/etc/init.d/apache2 -k restart
p.s. If you change "DocumentRoot" in apache2.conf, you'll need to change it in commonapahche2.conf as well.
Look for
###This should be changed to whatever you set Document root to.
###
<Directory /home/httpd/htdocs>
And in /etc/apache2/conf/modules.d/41_mod_ssl.default-vhost.conf for SSL to work
So far it works just fine for me, but time will show how stable and bug free it is
If you have any comment/suggestions - feel free to post
I hope this will be useful at leas to somebody.
Last edited by khel on Tue Apr 08, 2003 2:56 pm; edited 7 times in total |
|
Back to top |
|
|
digitalnick Apprentice
Joined: 30 Jun 2002 Posts: 243 Location: Lawrence KS USA
|
Posted: Fri Mar 07, 2003 6:48 am Post subject: |
|
|
kind of hard to write a specific guide for a webserver ... for example i just emerge apache dont usually have a mysql backend sometimes emerge php if its needed |
|
Back to top |
|
|
slartibartfasz Veteran
Joined: 29 Oct 2002 Posts: 1462 Location: Vienna, Austria
|
Posted: Fri Mar 07, 2003 9:04 am Post subject: |
|
|
i would go without xinetd and emerge mysql before (!) apache - also make sure that the useflags for mysql, apache2, php and the like are correct - its difficult to write a gentoo specific doc for this - as people set up their servers very differently depending on their needs... _________________ To an engineer the glass is neither half full, nor half empty - it is just twice as big as it needs to be. |
|
Back to top |
|
|
Buzzz n00b
Joined: 17 Apr 2002 Posts: 63 Location: Enschede, The Netherlands
|
Posted: Fri Mar 07, 2003 9:07 am Post subject: Re: Web Server How-To |
|
|
khel wrote: |
I'm not new to linux but really new to Gentoo anyway, for example what steps should be taken after finishing with Installation guide?
1. emerge xinetd (any use variables??)
2. rc-update add xinetd
|
I don't use xinetd, I think it is only confusing. All access control can be done in apache itself or with your firewall. I just like the stand-alone way of doing things. _________________ There are no stupid questions, but there are a lot of inquisitive idiots |
|
Back to top |
|
|
khel Tux's lil' helper
Joined: 07 Mar 2003 Posts: 80
|
Posted: Sun Mar 09, 2003 12:32 am Post subject: |
|
|
Just updated my original post. I hope it makes a little bit more sense now ... and following your example, decided to try running my system without xinetd (habits are so difficult to change ).
Thanks |
|
Back to top |
|
|
WarMachine Apprentice
Joined: 15 Jul 2002 Posts: 181
|
Posted: Sun Mar 09, 2003 5:21 am Post subject: |
|
|
Thanks I found this useful since I'm considering re-doing my gentoo machine. It's still on the old GCC 2.9.something...that's another story. As of now I didn't use emerge to install all these things, this would help a lot.
Would there be anything different if one was to use the latest stable version of apache instead of apache 2? |
|
Back to top |
|
|
slartibartfasz Veteran
Joined: 29 Oct 2002 Posts: 1462 Location: Vienna, Austria
|
Posted: Sun Mar 09, 2003 10:00 am Post subject: Re: Web Server How-To (Apache2 + mod_php + mysql) |
|
|
khel wrote: | Though I already had these USE flags in make.conf, mod_php was still showing X as a dependency , to fix this I ran
export USE="-X -gtk -gnome -alsa -qt -qtmt -pdflib mysql apache2 pam ssl"
|
perhaps u forgot to run env-update after changing the make.conf... _________________ To an engineer the glass is neither half full, nor half empty - it is just twice as big as it needs to be. |
|
Back to top |
|
|
WarMachine Apprentice
Joined: 15 Jul 2002 Posts: 181
|
Posted: Mon Mar 10, 2003 12:04 am Post subject: |
|
|
I've tried to follow this except using the latest (1.3.27) version of apache. Here's the result:
My ssl and php are not working, apache (with the exception of those two) is.
Quote: | root@localhost sbin # ./apachectl configtest
[Sun Mar 9 08:05:06 2003] [alert] apache: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Syntax OK
[Sun Mar 9 08:05:06 2003] [error] Cannot remove module mod_ssl.c: not found in module list
[Sun Mar 9 08:05:06 2003] [error] Cannot remove module mod_php4.c: not found in module list
|
Here are my USE flags
Quote: | USE="mysql apache mod_ssl mod_php -java"
|
|
|
Back to top |
|
|
khel Tux's lil' helper
Joined: 07 Mar 2003 Posts: 80
|
Posted: Mon Mar 10, 2003 1:12 am Post subject: |
|
|
WarMachine wrote: | I've tried to follow this except using the latest (1.3.27) version of apache. |
I didn't install apache 1.3.27 on my gentoo box, but you can try following the instructions in Desktop Configuration Guide |
|
Back to top |
|
|
WarMachine Apprentice
Joined: 15 Jul 2002 Posts: 181
|
Posted: Mon Mar 10, 2003 1:55 am Post subject: |
|
|
There's no real difference between that and these instructions except for these 2 lines
# ebuild /var/db/pkg/dev-php/mod_php-4.2.2-r1/mod_php-4.2.2-r1.ebuild config
# ebuild /var/db/pkg/net-www/mod_ssl-2.8.10/mod_ssl-2.8.10.ebuild config
these print and you're instructed to do them after you emerge each mod_php and mod_ssl anyway :\ |
|
Back to top |
|
|
WarMachine Apprentice
Joined: 15 Jul 2002 Posts: 181
|
Posted: Mon Mar 10, 2003 9:12 pm Post subject: |
|
|
I gave up and decided to use apache 2
although I can't get ssl working right and when I tried to turn it on in the phpBB (what I'm using the webserver+database for) I totally messed it up, whatever I'll figure it out all in due time |
|
Back to top |
|
|
WarMachine Apprentice
Joined: 15 Jul 2002 Posts: 181
|
Posted: Wed Mar 12, 2003 1:39 am Post subject: |
|
|
I've found I need to add -java to my USE to get mod_php to work correctly. If I don't have it there I get an error on configure. |
|
Back to top |
|
|
tgoodaire Tux's lil' helper
Joined: 31 Jan 2003 Posts: 145 Location: Dartmouth, Nova Scotia, Canada
|
Posted: Mon Mar 17, 2003 7:39 am Post subject: xinetd |
|
|
I like using xinetd for everything for several reasons. It starts and stops my servers for me as they are needed, so they're not sitting there taking up my RAM when they're rarely used. Also, there is much better access control and logging than what's in most standalone servers. It's not too hard to configure either. If you can figure out how to configure apache, xinetd should be a breeze. _________________ I bent my wookie. |
|
Back to top |
|
|
tabascal1 n00b
Joined: 21 Mar 2003 Posts: 71
|
Posted: Thu Apr 10, 2003 8:23 am Post subject: |
|
|
I am an newbie to gentoo.
I want to install apache 2.0.45
I am using 1.4.rc3
Though my USE='apache2"
Whenever I am doing emrge apache it installs apache 1.3.27.r3
If simply emerge /usr/portage/../apache 2.0.45 then after the installation it says apachectl not found
As a result I have to first installed apache 1.3 and apache 2
After this emerge mod_php and edit apache to -D PHP as perthe instruction on the screen. But PHP does not work.
Please help |
|
Back to top |
|
|
mxc Guru
Joined: 05 Mar 2003 Posts: 442 Location: South Africa
|
Posted: Sat Apr 12, 2003 4:59 pm Post subject: Apach2 and php4 - libpq.so.2: cannot open shared object |
|
|
Hi All,
I have emerged apache2 and php4. I have checked the steps as outlined by khel in the first post and all seems ok.
I have my php .so file in /etc/apache2/extramodules.
When I run apache2 start I get the following error
Syntax error on line 57 of /etc/apache2/conf/apache2.conf:
Cannot load /etc/apache2/extramodules/libphp4.so into server: libpq.so.2: cannot open shared object file: No such file or dir
How do I fix this? I know it may be simple to some of you but I am struggling a bit. I need to get to know php/apache/postgres to get a piece of software I want to evaluate, i.e tutos, working.
Thanks
Mark
Edit ****** Ok I have found a libpq.so.3 on my system. How do I edit php4 to use this instead of the .2 version? |
|
Back to top |
|
|
Pots n00b
Joined: 15 Apr 2003 Posts: 6
|
Posted: Tue Apr 15, 2003 12:37 pm Post subject: ehm |
|
|
I think
APACHE_OPTS="-D SSL -D PHP4"
should be
APACHE2_OPTS="-D SSL -D PHP4" |
|
Back to top |
|
|
d0wn_under Guru
Joined: 13 Mar 2003 Posts: 300 Location: Sheffield, England
|
Posted: Sun Apr 27, 2003 11:00 am Post subject: Same problem with Apache 1.3.27-r3 |
|
|
I get the same problem with apache 1.3.27-r3...
* Starting apache...
Syntax error on line 21 of /etc/apache/conf/apache.conf:
Cannot load /etc/apache/extramodules/libphp4.so into server: libpq.so.2: cannot open shared object file: No such file or directory [ !! ]
For a similar, but different problem, some people have suggested doing the following
export LDFLAGS='-lstdc++'
emerge sablotron
but it didn't work for me. apache does work if I take out php4 from the config files, but that doesn't help
Anyone any ideas?
Robin |
|
Back to top |
|
|
utabintarbo n00b
Joined: 29 Apr 2002 Posts: 53 Location: Warren, MI, USA
|
Posted: Wed Apr 30, 2003 3:51 pm Post subject: |
|
|
tabascal1 wrote: | ...
I want to install apache 2.0.45
...
Though my USE='apache2"
Whenever I am doing emrge apache it installs apache 1.3.27.r3
... |
I believe this particular bit might help:
khel wrote: | ...
edit /etc/make.conf and add
ACCEPT_KEYWORDS="~x86"
...
|
IIRC, the "~86" keyword allows masked ebuilds to be included. But it has been many moons, so check for yourself.
Bob _________________ Let the market decide!
And in case it wasn't apparent, sarcasm is yet another of the free services I offer. |
|
Back to top |
|
|
nepenthe Guru
Joined: 14 Jul 2002 Posts: 317 Location: Sanford, ME
|
Posted: Fri May 02, 2003 12:31 am Post subject: *FIXED* |
|
|
Quote: | Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName | having same error....
*resolved, to an extent*
strange I edit /etc/hostname change it to nep.servehttp.com
and then do Code: | hostname nep.serve.httpcom | and it works.
But after a restart it have to do Code: | hostname nep.servehttp.com | [/code]
again... hmmm
Last edited by nepenthe on Fri May 02, 2003 2:17 am; edited 1 time in total |
|
Back to top |
|
|
nepenthe Guru
Joined: 14 Jul 2002 Posts: 317 Location: Sanford, ME
|
Posted: Fri May 02, 2003 1:34 am Post subject: |
|
|
Anyone know how to setup directory browsing, or indexing with apache2? |
|
Back to top |
|
|
ggelln Tux's lil' helper
Joined: 24 Jan 2003 Posts: 98 Location: Montreal Quebec
|
Posted: Thu May 29, 2003 2:08 pm Post subject: |
|
|
thanks for this post it has helped me out
question, what is the difference between
"-D PHP" and "-D PHP4"
ah see a spatering of both when I search.
Gabriel |
|
Back to top |
|
|
mta n00b
Joined: 02 Jun 2003 Posts: 28 Location: Australia
|
Posted: Wed Jun 04, 2003 8:44 am Post subject: |
|
|
I tried so many combinations of stuff to get apache 1.3 working, with no luck. used this tutorial for apache2 which helped a lot, thanks
For me it didn't work first time, I had to make these changes:
-java in USE, otherwise apache wouldn't compile
these 4 lines in /etc/apache2/conf/apache2.conf:
LoadModule php4_module /usr/lib/apache2-extramodules/libphp4.so
LoadModule ssl_module /usr/lib/apache2-extramodules/mod_ssl.so
Include conf/modules.d/40_mod_ssl.conf
Include conf/modules.d/41_mod_ssl.default-vhost.conf |
|
Back to top |
|
|
chatgris Guru
Joined: 14 Oct 2002 Posts: 383 Location: Canada
|
Posted: Thu Jun 05, 2003 7:48 am Post subject: Re: Apach2 and php4 - libpq.so.2: cannot open shared obje |
|
|
mxc wrote: | Hi All,
I have emerged apache2 and php4. I have checked the steps as outlined by khel in the first post and all seems ok.
I have my php .so file in /etc/apache2/extramodules.
When I run apache2 start I get the following error
Syntax error on line 57 of /etc/apache2/conf/apache2.conf:
Cannot load /etc/apache2/extramodules/libphp4.so into server: libpq.so.2: cannot open shared object file: No such file or dir
How do I fix this? I know it may be simple to some of you but I am struggling a bit. I need to get to know php/apache/postgres to get a piece of software I want to evaluate, i.e tutos, working.
Thanks
Mark
Edit ****** Ok I have found a libpq.so.3 on my system. How do I edit php4 to use this instead of the .2 version? |
libpq.so.2 is postgres interface..
Either you need to install postgres, or compile php with -postgresql
hope that helps. _________________ Open your mind. Open your source.
Due credit for avatar from http://www.aikida.net |
|
Back to top |
|
|
Decode n00b
Joined: 26 Apr 2003 Posts: 12
|
Posted: Wed Jun 18, 2003 11:48 am Post subject: rc-update add mysqld default problem |
|
|
Code: | # emerge mysql
# rc-update add mysqld default
* /sbin/rc-update: /etc/init.d/mysqld not found; aborting. |
I'm not quite sure what to do here. I recompiled mysql twice and same error.
mysql version: 4.0.13 _________________ /--------------------------------------------------\
x ∈ U ∆ V ↔ ( x ∈ U ∪ V ∧ x ¬∈ U ∩ V )
\--------------------------------------------------/ |
|
Back to top |
|
|
nepenthe Guru
Joined: 14 Jul 2002 Posts: 317 Location: Sanford, ME
|
Posted: Wed Jun 18, 2003 11:50 am Post subject: |
|
|
what about trying
Code: | rc-update add mysql defaul |
I think when I had setup mysql the init script was called mysql not mysqld
Just a thought =]
~nep |
|
Back to top |
|
|
|