Click to See Complete Forum and Search --> : Oooops, please help for my apache! URGENT!


ckevin
11-28-2000, 11:04 AM
it works perfectly but after i edit the httpd.conf for mod_rewrite and failed, the file at /etc/rc.d/init.d/httpd was deleted accidentally and now I cannot restart my apache... can you tell me how to recover my server?

My Apache version 1.3.12

Error message:

/etc/rc.d/init.d/httpd: No such file or directory

If you can send me that file or it is the solution, you can send the file at i227@hotmail.com. I'm much hurry about it and your little help is very useful to me!

Thanks very much,

Kevin

mangeli
11-28-2000, 11:10 AM
What OS are you running (if it's linux what flavor) inet.d isn't a directory. To start your apache server up, type this as root at the command line (or you could just reboot)

/usr/local/apache/bin/apachectl start &

I think that will start your server for you

ckevin
11-28-2000, 11:29 AM
mangeli, thanks very much, u really give me a favor, the server is working fine now. http://www.linuxnewbie.org/ubb/smile.gif

However, it seems don't recover the "/etc/rc.d/init.d/httpd" problem, and i believe when the server boot up next time, the apache won't start because that file is missing...

can you tell me how can I recover that file so that my server can start httpd everytime it boots up?

thanks so much.


kevin

PS. Can you also tell me how to enbale the "mod_rewrite" (/check if it is enabled) because i need this module for my server. thanks.

mangeli
11-28-2000, 11:33 AM
Originally posted by ckevin:
mangeli, thanks very much, u really give me a favor, the server is working fine now. http://www.linuxnewbie.org/ubb/smile.gif

However, it seems don't recover the "/etc/rc.d/init.d/httpd" problem, and i believe when the server boot up next time, the apache won't start because that file is missing...

can you tell me how can I recover that file so that my server can start httpd everytime it boots up?

thanks so much.


kevin

PS. Can you also tell me how to enbale the "mod_rewrite" (/check if it is enabled) because i need this module for my server. thanks.


There is no such file. It doesn't exist.

I don't know how to add the mod_rewrite.

Sweede
11-28-2000, 01:30 PM
how did you install apache?
with RPM ??
if you used the apache 1.3.14 rpms, mod-rewrite is already there and working. read the manual on how to use it.

as for /etc/rc.d/init.d/http
that file is your apachectl file.
symlink it or copy it back.
you dont need the & when starting apache, all though at the same token, it doesnt do anything.

Sweede
11-28-2000, 05:19 PM
oh yea, upgrade to apache 1.3.14
1.3.12 has a root exploit in the mod_rewrite module

download the RPM and type
RPM -Uhv package

ckevin
11-28-2000, 09:47 PM
Sweede,

Thanks for your advance. I have installed the Apache 1.3.14 using RPM on my RedHat 6.2. However, it installed into /etc/httpd. But my original Apache path is on /usr/local/apache. So I need to edit the httpd.conf at /etc/httpd manually for those virtual host...

My question:
(1) How can I enable .php file (php 4)because in my old Apache, I can read php by adding

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

in httpd.conf but adding the above lines to the new httpd.conf file, the PHP can't work.

(2) What is the "Path to httpd executable", I need this info in order to use my current Webmin.

(3) In the /bin/httpd, I only can find "conf" folder, but my old apache have lots of folder such as "bin", "include", "man", "proxy" etc. do I need to move them all to the new "httpd" folder?

Again, really thanks for your little help which I need so much. http://www.linuxnewbie.org/ubb/smile.gif

Thanks,


Kevin

Sweede
11-28-2000, 11:03 PM
lets start off with this..


how did you install apache 1.3.12 and php 4.0.x ??

ckevin
11-29-2000, 01:54 AM
They are not installed myself, actually, i believe Apache was installed with RH 6.2 and php4 installed after it, the Webmin shows that the mod_php4 was installed in the old Apache... but I don't think the new Apache detect it and display the php files correctly... hope this help you identified the problem.

If you need to know which path have which files, i can find it and tell you here.

Besides, what I have downloaded from RH is:

i386:
ftp://updates.redhat.com/6.2/i386/apache-1.3.14-2.6.2.i386.rpm
ftp://updates.redhat.com/6.2/i386/apache-devel-1.3.14-2.6.2.i386.rpm
ftp://updates.redhat.com/6.2/i386/apache-manual-1.3.14-2.6.2.i386.rpm
ftp://updates.redhat.com/6.2/i386/auth_ldap-1.4.0-3.i386.rpm
ftp://updates.redhat.com/6.2/i386/mod_perl-1.23-3.i386.rpm

I also downloaded and installed:
ftp://updates.redhat.com/7.0/i386/mod_php-4.0.3pl1-1.i386.rpm
ftp://updates.redhat.com/7.0/i386/php-4.0.3pl1-1.i386.rpm
but my php still can't work with the new Apache on RH 6.2... please help!

Thanks very much,

Kevin

[This message has been edited by ckevin (edited 29 November 2000).]

Sweede
11-29-2000, 03:54 PM
Originally posted by ckevin:
They are not installed myself, actually, i believe Apache was installed with RH 6.2 and php4 installed after it, the Webmin shows that the mod_php4 was installed in the old Apache... but I don't think the new Apache detect it and display the php files correctly... hope this help you identified the problem.

If you need to know which path have which files, i can find it and tell you here.

Besides, what I have downloaded from RH is:

i386:
ftp://updates.redhat.com/6.2/i386/apache-1.3.14-2.6.2.i386.rpm
ftp://updates.redhat.com/6.2/i386/apache-devel-1.3.14-2.6.2.i386.rpm
ftp://updates.redhat.com/6.2/i386/apache-manual-1.3.14-2.6.2.i386.rpm
ftp://updates.redhat.com/6.2/i386/auth_ldap-1.4.0-3.i386.rpm
ftp://updates.redhat.com/6.2/i386/mod_perl-1.23-3.i386.rpm

I also downloaded and installed:
ftp://updates.redhat.com/7.0/i386/mod_php-4.0.3pl1-1.i386.rpm
ftp://updates.redhat.com/7.0/i386/php-4.0.3pl1-1.i386.rpm
but my php still can't work with the new Apache on RH 6.2... please help!

Thanks very much,

Kevin

[This message has been edited by ckevin (edited 29 November 2000).]


remove all of those RPMS, you probably wont use mod_ldap and mod_perl isnt as fast as php, although it allows you to embed perl into apaches httpd.conf file, i doubt you'll even be needing that feature.

download the source files to apache and php http://httpd.apache.org/dist/apache_1.3.14.tar.gz http://www.php.net/downloads.php

delete your /etc/httpd directory (your current httpd.conf will probably change, save it for updated info). delete your /usr/local/apache directory (agian, except for .conf files and any web docs)

untar then somewhere, doesnt really matter,
cd apache_1.3.14
./configure \
--enable-module=most \
--enable-shared=max \
--enable-suexec \
--suexec-caller=httpd \
--suexec-docroot=/home \
--server-uid=httpd \
--server-gid=httpd \
--with-layout=RedHat
make
make install

this will install Apache+suexec in almost the same place that the RPMS do,
/etc/httpd/conf/*.conf, etc..

ok, now for php

cd into the php source directory.

lynx -dump -source http://www.php.net/extra/number4.tar.gz | gzip -d | tar xvf -

then run

./configure \
--with-ftp \
--enable-bcmath \
--with-ttf \
--with-apxs=/usr/sbin/apxs \
--with-zlib \
--with-gd \
--enable-transparent-sid \
--with-config-file-path=/etc/httpd/conf
make
make install


that should do you just fine and will install the php.ini file in /etc/httpd/conf
if there is anything else you want, just browse through the manual at php.net http://www.php.net/manual/install.configure.php
for configuration options.


Now, open up your apache conf file,
[fav editor] /etc/httpd/conf/httpd.conf
and goto around line 750 and uncomment these lines

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

it also wouldnt hurt to add another AddType for whatever extensions you want
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .dogbone
etc....

test your config...
/usr/sbin/apachectl configtest
[should see syntax OK] and if all is well..
/usr/sbin/apachectl start

and your set.

if you want this to start automaticly on boot,
/sbin/chkconfig --add /usr/sbin/apachectl
( i think, you might have to play with that or read the man page for it)

[This message has been edited by Sweede (edited 03 December 2000).]

ckevin
11-29-2000, 08:53 PM
Sweede,

Thank you so much for your detailed and much clear explaination! http://www.linuxnewbie.org/ubb/smile.gif

Just a little query...

Currently I have some virtual sites there with PHP files... and I don't want to interrupt their service uptime, so before your previous reply, I just switch my Apache back to 1.3.12, and now can I only delete the all the RPMs and /etc/httpd but not the /usr/local/apache (currently using)? After I install and test the Apache with PHP4 successfully, then delete the /usr/local/apache?

Also, currently I have MySQL with PHP4 work perfectly, do I need to re-install/configure MySQL to use under the new Apache and PHP4?

Thanks,

Kevin

Sweede
11-29-2000, 09:14 PM
make sure you stop the old apache first, then start the new apache.

as long as your httpd.conf file works, you shouldnt have more than a minute of interupted service (based on how fast you can type http://www.linuxnewbie.org/ubb/smile.gif )

in your new apache installation, to make sure thing goes screwy, remove the "Port" directive and use "Listen 81"

then start apache, it will bind to port 81 so you can test it.

if all works great, then change the listen back to 80, stop old start new.

only frontpage will ***** about not having the Port directive.

ckevin
11-29-2000, 10:50 PM
Sweede,

I would start the work these days, hope to bring you some good news here! http://www.linuxnewbie.org/ubb/smile.gif

Actually, do your think the details you gave is enough for also my MySQL up, cause you haven't told me "do I need to re-install/configure MySQL to use under the new Apache and PHP4"...

Enjoy!


Kevin

Sweede
11-30-2000, 12:41 AM
i must of posted that in a different thread.

php4 has built in mysql support.

unless you're using several modules with apache/php that require MySQL (such as mod_auth_mysql), then you will need to specify --with-mysql=/path/to/mysql

other than that, its already in there.

ckevin
11-30-2000, 04:18 AM
I have installed the Apache and PHP4 using the detailed instructions above. However, one big problem is that after starting the new Apache,

I go to the site but said "(111) Connection refused. in my IE"...

How to solve the problem? Am I anything wrong here? (I use "nobody" as my User Name and Group in httpd.conf)

Besides, what is the PHP build in MySQL support for the path of MySQL? Is it /usr/local/mysql ?

Thanks,

Kevin

Sweede
11-30-2000, 06:30 AM
php support for mysql doesnt use sockets, it used tcp connections.
if you start MySQL without tcp/ip connection capabilities(--skip-networking), it wont work. if for whatever reason you dont want to use this (which there is none, i have yet to find/see a hole in MySQL where you can get root access), you can accomplish the same thing by using better restrictions in the MySQL access list. (MySQL USERS ARE NOT LINUX SYSTEM USERS).

again, check the error log, what does it say?

i almost always have 3 PuTTy sessions open, one tailing the error_log, one always logged in as root in case i do something stupid to the window im working in (like somehow change root password or whatever). or i use it to do MySQL stuff as im changing something else.

tail the error log ( use the -f flag).

also, is this an apache error or a php error ?
a little more detail.

ckevin
11-30-2000, 09:13 AM
My error_log of Apache:

[Thu Nov 30 09:08:54 2000] [notice] Apache/1.3.14 (Unix) PHP/4.0.3pl1 configured -- resuming normal operations
[Thu Nov 30 09:08:54 2000] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

Do you think I need to re-install the updated Apache RPMs from RedHat.com?

Thanks really so much!

Kevin

[This message has been edited by ckevin (edited 30 November 2000).]

Sweede
11-30-2000, 03:49 PM
you should of had un-installed ALL RPMS to where you do not need them any more.

the updated RPMS from redhat are the perfect reason why i do not use RPMS (unless i make them).

you still didnt tell me what you are doing when you get that error.

ckevin
11-30-2000, 10:14 PM
Actually, I forgot to kick the Apache 1.3.14 RPM away before I install the Apache using your method...

I wish to remove Apache RPM and start over once. But when I type

rpm -e apache-1.3.14-2.6.2

It said "service httpd does not support chkconfig" and "execution of apache-1.3.14-2.6.2 script failed, exit status 1"

So it's a big trouble http://www.linuxnewbie.org/ubb/frown.gif Hope you still can help me :>

I still switch back to 1.3.12 so that sites won't down at this moment...

Thanks,


Kevin

Sweede
11-30-2000, 10:26 PM
that RPM should of removed although that failed, but it doesnt matter.

install new apache,
stop old apache
start new apache.

removing the old RPMS are not a nesesity, that just to save a couple megs on your disk.

the error(111), that you get.
is that from a PHP script ?

ckevin
11-30-2000, 10:31 PM
thanks for fast response... http://www.linuxnewbie.org/ubb/smile.gif

well, i maybe fool here, but where is the php log file so that i know if they shout the "error(111)" or apache?

thanks,

Kevin

Sweede
11-30-2000, 11:03 PM
by default, php doesnt record to an error log.
you can change this in the php.ini file though.

i beleive i set it to be in /etc/httpd/conf
you'll have to copy the php.ini-dist from the php source to /etc/httpd/conf/php.ini IF it is not already there.

the comments in the ini file are simple to follow

ckevin
11-30-2000, 11:47 PM
Sorry, but some sort of questions I need to be clarified:

To maintain a clean server, I really want to start over what I've done...

(1) How can I "rpm -e" the apache, without the error message?

(2) How can I remove the Apache / PHP4 which is installed from TAR (not rpm)?

(3) Can I remove the PHP source dir. after installed the PHP4?

Thanks

[This message has been edited by ckevin (edited 30 November 2000).]

Sweede
12-01-2000, 03:51 AM
1) rpm -e --force
works

2) that other apache install would be a pain, it installs files all over the place.
i really wouldnt worry about that installtion because it works fine.

3) yep, but save the tarball so you can re-compile it if you want to add a feature or something.


if you want to remove the tarball apache,
rm /etc/httpd/ -rf
rm /usr/bin/htpasswd
rm /usr/bin/htdigest
rm /usr/bin/dbmmanage
rm /usr/sbin/apachectl
rm /usr/sbin/httpd
rm /usr/sbin/suexec
rm /usr/sbin/ap
rm /usr/sbin/apxs
rm /usr/sbin/rotatelogs
rm /usr/sbin/logresolve
rm /usr/lib/apache -r
rm /usr/lib/php -r
rm /usr/include/apache -r
rm /usr/include/php -r
deluser -r httpd
rm /home/httpd -r
rm /var/log/httpd -r
rm /var/cache/httpd

should get it all.

ckevin
12-01-2000, 01:28 PM
Sweede, really thank you very much... you still sit here and helping me http://www.linuxnewbie.org/ubb/wink.gif

However, for (1) I try to :

rpm -e --force apache-1.3.14-2.6.2

but the error message said:

rpm: only installation, upgrading, rmsource and rmspec may be forced

Besides, I believe if the "service httpd support chkconfig", then I might use "rpm -e" to delete Apache RPMs without problems...

Thanks,


Kevin

Sweede
12-01-2000, 02:26 PM
yea, i wasnt sure if that would work or not.
rpm -ql apache_1.3.14 will list all the files apache installed
`` runs a command
rm is a command

rm `rpm -ql apache_1.3.14` -r

will work fine (this will prompt you yes or no for each file/folder, you can use the f [force] flag with caution !!)

ckevin
12-01-2000, 10:34 PM
Finally I have deleted all the Apache Files and when type "rpm -q apache", no apache was installed, so I start to re-install the Apache / PHP4 and hope to give u a good news this time, thanks Sweede very much! You really help me a lot! :-P

[This message has been edited by ckevin (edited 01 December 2000).]

ckevin
12-02-2000, 01:27 AM
Install Apache and PHP4 using TAR with Sweede methods...

I have installed Apache 1.3.14 and I make sure it works in my server.

Then, I install PHP4 with:

./configure \
--with-ftp \
--enable-bcmath \
--with-ttf \
--with-apxs=/usr/local/apache/bin/apxs \
--with-zlib \
--with-gd \
--enable-transparent-sid \
--with-mysql=/usr/local/mysql \
--with-config-file-path=/usr/local/apache/conf
make
make install

However, when I type ./apachectl to restart...

Error message:

Syntax error on line 238 of /usr/local/apache/conf/httpd.conf: Cannot laod usr/local/apache/libexec/libphp4.so into server: libmysqlclient.so.6: cannot open shared object file: No such file or directory
./apachectl start: httpd could not be started

PS. In /usr/local/apache/logs, it has "httpd.pid"... and in the "libexec" folder, there still has the libphp4.so file but no "libmysqlclient.so.6" file, that file is at /usr/local/mysql/lib/mysql ...

So, what's the problem?

Thanks,

kevin

[This message has been edited by ckevin (edited 02 December 2000).]

ckevin
12-02-2000, 04:33 AM
YES, finally, I add alias file "libmysqlclient.so.6" at /usr/lib and point to "/usr/local/mysql/lib/mysql" it works perfectly now.

So happy lol, thru this activity, I have learned so much things, thanks both mangeli
and Sweede!

Both Apache 1.3.14, PHP4 and MySQL is done!

Thanks all!

kevin

Sweede
12-02-2000, 05:49 AM
Originally posted by ckevin:
YES, finally, I add alias file "libmysqlclient.so.6" at /usr/lib and point to "/usr/local/mysql/lib/mysql" it works perfectly now.

So happy lol, thru this activity, I have learned so much things, thanks both mangeli
and Sweede!

Both Apache 1.3.14, PHP4 and MySQL is done!

Thanks all!

kevin


that worked ???
weird.. you got that error because the libmysqlclient.so wasnt in the lib path..
had you added..
/usr/lib/mysql
to the /etc/ld.conf file (its actually something else, but close http://www.linuxnewbie.org/ubb/smile.gif)
and ran /sbin/ldconfig
it would of worked just fine.


i usally create a directory /usr/mysql
then symlink the include/mysql to /usr/mysql/include, and the lib/mysql to the /usr/mysql/lib directorys.....

but hey, it works and good work http://www.linuxnewbie.org/ubb/biggrin.gif

any other questions, i'll be glad to help