Skip to content

Commit

Permalink
add php-info.php file and restrict to local access
Browse files Browse the repository at this point in the history
  • Loading branch information
glynhudson committed Jun 23, 2016
1 parent 414a9f6 commit 8465db4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
11 changes: 10 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,13 @@ AddDefaultCharset utf-8
Require all denied
</IfModule>

</FilesMatch>
</FilesMatch>

# protect phpinfo, only allow localhost and local network access
<Files php-info.php>
Order Deny,Allow
Deny from all
Allow from 10
Allow from 172
Allow from 192
</Files>
10 changes: 4 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,14 @@

$mqtt = false;

# Check MySQL PHP modules are loddee
# Check MySQL PHP modules are loaded
if (!extension_loaded('mysql') && !extension_loaded('mysqli')){
echo "php mysql extension(s) not loaded. <br>";
echo "Your PHP installation appears to be missing the MySQL extension which is required by Emoncms."; die;
echo "Your PHP installation appears to be missing the MySQL extension(s) which are required by Emoncms. <br> See /php-info.php (restricted to local access)"; die;
}

# Check Gettext PHP module is loded
# Check Gettext PHP module is loaded
if (!extension_loaded('gettext')){
echo "php gettext extension(s) not loaded. <br>";
echo "Your PHP installation appears to be missing the gettext extension which is required by Emoncms."; die;
echo "Your PHP installation appears to be missing the gettext extension which is required by Emoncms. <br> See /php-info.php (restricted to local access)"; die;
}

$mysqli = @new mysqli($server,$username,$password,$database,$port);
Expand Down
3 changes: 3 additions & 0 deletions php-info.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
# protected and only access from localhost & local network (see .htaccess)
phpinfo(); ?>

0 comments on commit 8465db4

Please sign in to comment.