How to restart Apache with PHP

If you ever need to restart Apache via PHP, you’ll notice that the “passthru” command doesn’t quite work out like you thought it would. For those of you who have cpanel and WHM installed, this will be an easy solution.  cpanelmatt at the cpanel forums created an XML-API PHP class to be able to handle situations like this.

First download the XML-API PHP class.

Next, follow the code example below:


$ip = "";
$root_pass = "somepass";

$xmlapi = new xmlapi($ip);


print $xmlapi->restartsrv('httpd');

Finally Using WordPress

After 5 long years using my own blog script, now uses wordpress.  This means that my old blog is still alive and can be accessed (via google searches), but I won’t be spending the time to convert it to wordpress.  From this point on it’s all new content.

The change to wordpress means that I will be able to make better postings and more frequently due to how easy it is.  My first post on wordpress will touch on how to use EasyApache with WHM.

Stay tuned!