Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I compiled Apache and PHP from source on a RedHat server, but in doing that, I forget to install the httpd as service.

Files used to compile Apache 2.4.7

files to compile apache 2.4.7

Command used to compile Apache 2.4.7

./configure --prefix=/etc/apache247 --with-included-apr --with-pcre --enable-so --enable-rewrite=shared --with-layout=Apache --enable-modules=most --enable-mods-shared=all;

Directory of Apache 2.4.7

apache 2.4.7 directory

Script of init.d to start Apache 2.4.7

I found this script in stackoverflow. It's not mine and not official.

Some users have told me that there is a script in the apache folder, but I have not found.

init.d apache script

If you prefer the text:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          apache247
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: apache247
# Description: Start apache247
### END INIT INFO

case "$1" in
start)
        echo "Starting Apache ..."
        # Change the location to your specific location
        /etc/apache247/bin/apachectl start
;;
stop)
        echo "Stopping Apache ..."
        # Change the location to your specific location
        /etc/apache247/bin/apachectl stop
;;
graceful)
        echo "Restarting Apache gracefully..."
        # Change the location to your specific location
        /etc/apache247/bin/apachectl graceful
;;
restart)
        echo "Restarting Apache ..."
        # Change the location to your specific location
        /etc/apache247/bin/apachectl restart
;;
*)
        echo "Usage: '$0' {start|stop|restart|graceful}"
        exit 64
;;
esac
exit 0

ntsysv

I use this command to check the services on RedHat. So, I put the init.d script in the correctly folder - /etc/init.d/ - but the apache2 script not appear here.

enter image description here

And after I restart the server, apache was not started automatically.

So, whats wrong?

I don't know in what log I get this errors of startup scripts.


share|improve this question
2  
Is there a good reason why you've compiled from source? –  MadHatter Apr 29 at 14:01
2  
1  
chkconfig --add apache247 && chkconfig apache247 on –  Aaron Copley Apr 29 at 14:28
1  
@AaronCopley It's works my friend, please write an answer for me please. –  Patrick Maciel Apr 29 at 15:59
2  
That is a very poor reason indeed to stop using the distro versions, which are kept fully-patched as long as the distro remains in-life. –  MadHatter Apr 29 at 17:39

2 Answers 2

up vote 1 down vote accepted

It sounded like you needed to register the init script with chkconfig --add apache247. You can then mark it as 'on' for the default run-levels with chkconfig apache247 on. A reboot should verify this will work as expected.

share|improve this answer
    
Thanks. It's work. –  Patrick Maciel Apr 29 at 17:18

Is apache installed in /etc/apache247/bin/apachectl ?

Because that script its looking into apache on that folder.

If it is not installed on that path, just edit the init file to point it to the right folder.

share|improve this answer
    
Where is the script? In what folder in /etc/apache247/? –  Patrick Maciel Apr 29 at 15:59
    
Ohhh, I see: the apachectl is the script right? –  Patrick Maciel Apr 29 at 16:01
    
The script you posted is named apache2 and as you told earlier you put that script into the /etc/init.d folder with 755 permissions. If you read analize the file you posted, you will see that it tells you to edit the path to the apachectl binary file. I was asking you if you know if that file actually exists in the /etc/apache247/bin folder. If it doesn´t exist, you must point the script to the correct location of the file. –  Trinue Apr 29 at 16:13
    
The script I posted I found in stackoverflow, is not the same of /etc/apache247/bin/apachectl. –  Patrick Maciel Apr 29 at 16:34
    
I try use the script of apachectl or httpd in the bin folder, but chkconfig not accetped. –  Patrick Maciel Apr 29 at 16:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.