Litecoins Blog Remotely monitoring your CGMiner Mining Rig with Miner.php on Ubuntu

Remotely monitoring your CGMiner Mining Rig with Miner.php on Ubuntu 9

If you have CGMiner installed for your litecoin mining then you may of noticed a file called miner.php found in the root folder.

This will allow you to monitor your server over the internet remotely whenever you wish.

You do need to take a few steps first to get this working though. This method is for those who are using Linux. I am running XUbuntu

Install Apache

sudo apt-get install apache2

Install PHP & MYSQL

sudo apt-get install php5
sudo apt-get install php5-mysql
sudo apt-get install libapache2-mod-php5

Now you need to restart Apache. You need to do this for it to work

sudo /etc/init.d/apache2 restart

To test Apache is working point your web browser to


If you read “It works! then your Apache is working ok

Open up miner.php found in your CGMiner root directory in your editor
Now make the following changes

$readonly = true; # A good idea if this is purely for monitoring
$autorefresh = 30; # This enables automatic refresh

Now save the file as miner.php

The next step is to copy miner.php from your CGMiner folder
Copy this file into /var/www/

Start CGMiner ensuring you add the following switches –api-listen and –api-network to be able to talk to the webpage

Check CGMiner is running with ps -ef|grep cgminer
Then open up http://localhost/miner.php in your web browser

Now hopefully this should show your realtime stats for CGMiner.
You can then setup your router to allow remote access from anywhere
using your Internet IP address.

Screenshot of Miner.php monitoring tool for cgminer

9 thoughts on “Remotely monitoring your CGMiner Mining Rig with Miner.php on Ubuntu

  1. Reply LbYttXy4UqSDXUdP345jpUvq6MR997GX3L May 23,2013 1:53 pm

    You need to do “sudo apt-get install libapache2-mod-php5” to plug PHP into Apache before you restart.

  2. Reply biganth May 23,2013 2:29 pm

    Is there a solution to monitor all rigs on the network where you can see them all on one page? To set this up on any quantity of rigs obviously won’t scale as you’ll need to check many tabs for each rig.

  3. Reply Lite Coins Miner May 23,2013 4:10 pm

    There are some options to monitor multiple rigs.

    One option is to use BAMT a ready made Linux based Mining Operating system. This includes a web based monitor for multiple rigs.

    Alternatively some people have come up with php scripts that you can install on your server to do this for cgminer.

    One fairly well known Web front-end is ANUBIS. Project files below.

    Or you can try this one. I haven’t tested these scripts but will do in the next few weeks

  4. Reply Lite Coins Miner May 23,2013 4:20 pm

    LbYttXy4UqSDXUdP345jpUvq6MR997GX3L – Thank you. I have updated the instructions with this missing step.

  5. Reply CoinXplorer Jun 4,2013 8:04 am

    Thanks for guidance. Very much appreciated. Got it working, but not without some troubleshooting:

    – for copying into /var/www/ one needs to have permissions. Tried different approaches and finally one of them worked. Which one? Beats me 😉

    – cgminer needs two extra switches to be able to “talk” to the webpage:
    “–api-listen” and “–api-network”

    With those additions xubuntu boots from usb flash drive, autostarts the miner and miner.php does what it is supposed to do. Thanks again.

  6. Reply CoinXplorer Jun 24,2013 9:20 pm

    Had to “discover” once again how to get root permissions and be able to alter files in /var/www/:
    $ sudo -i
    $ sudo passwd root

    And immediately after you have finished as root, re-disable for security:
    $ sudo passwd -dl root

    Another suggestion might be to use myminer.php for customizing the page:


  7. Reply Jaybee3014 Mar 9,2014 8:35 pm

    I have followed your steps…when I get to “Check CGMiner is running with ps -ef|grep cgminer
    Then open up http://localhost/miner.php in your web browser” when I open the browser to that URL I get the top buttons and the background color but I get the following message: “Error getting device list: ERR: socket connect(0) failed”


    • Reply Lite Coins Miner Mar 14,2014 10:02 pm

      When you started up cgminer did you ensure you had the following switches –api-listen and –api-network
      You need these in order for cgminer to be able to talk to the webpage

  8. Reply Icarus Mar 15,2014 3:40 am

    does this allow adding and removing pools?
    or not really?


Leave a Reply




This site uses Akismet to reduce spam. Learn how your comment data is processed.