Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Saturday, November 30, 2013

Display system and memory info of Raspberry Pi with PHP

The former post describe how to "Install LAMP web server on Raspberry Pi". We can create a PHP page (/var/www/testphp.php) to display system and memory info of Raspberry Pi on our web page.

<?php
list($system, $host, $kernel) = split(" ", exec("uname -a"), 5);

$meminfo = file("/proc/meminfo");
$infodetails = "<b>memory info</b><br/>";
for ($i = 0; $i < count($meminfo); $i++) {
 list($item, $data) = split(":", $meminfo[$i], 2);
 $item = chop($item);
 $data = chop($data);
 
 $infodetails .= $i." : ".$item." = ".$data."<br/>";
}
?>
<html>
<head>
<title>Hello Raspberry Pi</title>
</head>
<body>
<ul>
<li><?php echo $system ?></li>
<li><?php echo $host ?></li>
<li><?php echo $kernel ?></li>
</ul>
<?php echo $infodetails; ?><br/>
</body>
</html>

Display system and memory info of Raspberry Pi with PHP
Display system and memory info of Raspberry Pi with PHP

Tuesday, November 19, 2013

Install PHP5 on Raspberry Pi

To install PHP5 on Raspberry Pi, simple enter the command:
$ sudo apt-get install php5

Display Raspberry Pi system info using php script
The video below also demonstrate how to create a test file to display PHP info, and also retrieve and display Raspberry Pi info with php script.

Sunday, November 17, 2013

Install LAMP web server on Raspberry Pi

The term "LAMP" refer to the common configuration for webservers which standard for:

  • Linux operating system
  • Apache webserver
  • MySQL database server
  • PHP
Installation:

Install Apache 2 Web Server on Raspberry Pi


Install PHP5 on Raspberry Pi


- Install MySQL on Raspberry Pi


Related post:
- Display system and memory info of Raspberry Pi with PHP