Results 1 to 3 of 3

Thread: PHP FILE RESTART APACHE

  1. #1

    Default PHP FILE RESTART APACHE

    Hi,

    Not sure where to put this thread that is why I am posting here.

    Here's my problem, i want to restart apache service using a php file or via Web. I know I can restart it using SSH but I am wondering how to restart the apache service using PHP or via WEB

    I am using the very simple command below and it is not working
    <?php
    shell_exec ('service apache2 restart');
    ?>

    Thanks in advance

    NAME="openSUSE Leap"
    VERSION="42.3"

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,136

    Default Re: PHP FILE RESTART APACHE

    Well, when you SSH into the system, I presume you log in and then have your preferred way to execute the service command as a root owned process.

    As the Apache processes, including the PHP spring-offs, do not run as a root process, the command will not function.

    I assume that should not surprise you, because it would be a security hole measured in miles wide and deep.
    Henk van Velden

  3. #3

    Default Re: PHP FILE RESTART APACHE

    I don’t have anything to hide, but I don’t have anything I want to show you either.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •