I have searched for an answer and couldn’t find one, but I’m wondering, is it possible for users/virtual-servers, to restart apache?
Or restart their instance of apache? For example, if I change a php.ini file as a virtual-server/user login, I then have to log out and back in as root to restart apache for the changes to take effect.
So basically, is there a way for a user to restart apache?
First: A regular user should never be able to manipulate system service, including restarting them.
In this case: there is no “their instance of Apache”; there is only one Apache process (with possible child processes) shared for all virtual servers.
The thing that is per-server is the PHP-CGI process, in case you’re using FCGId as PHP calling method, as opposed to mod_php.
So, to apply changes to php.ini without root-restarting Apache, you for one need to be using FCGId, since only then does every virtual server have its own copy of the ini file and its own PHP process. After making the changes, it should then suffice to kill the PHP process that is running under the virtual server’s administrative username. Use ps aux | grep php5-cgi to list all those PHP processes. The first column in the output should be the username.
Yeah, that should work. Just make sure Apache does a gracelful restart then, otherwise your web server will be down for a few seconds for all users, including breaking of existing connections (in case some web service uses persistent connections).