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:

# 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

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


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.

  • 2
    Is there a good reason why you've compiled from source? – MadHatter Apr 29 '14 at 14:01
  • 2
  • 1
    chkconfig --add apache247 && chkconfig apache247 on – Aaron Copley Apr 29 '14 at 14:28
  • 1
    @AaronCopley It's works my friend, please write an answer for me please. – Patrick Maciel Apr 29 '14 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 '14 at 17:39

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.


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.

  • Where is the script? In what folder in /etc/apache247/? – Patrick Maciel Apr 29 '14 at 15:59
  • Ohhh, I see: the apachectl is the script right? – Patrick Maciel Apr 29 '14 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 '14 at 16:13
  • The script I posted I found in stackoverflow, is not the same of /etc/apache247/bin/apachectl. – Patrick Maciel Apr 29 '14 at 16:34
  • I try use the script of apachectl or httpd in the bin folder, but chkconfig not accetped. – Patrick Maciel Apr 29 '14 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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