This is a secure method to debug your apache from within php

Table of Contents

  1. Introduction
    1. For debugging without checking error_log/access_log files
    2. Add security to phpinfo.php
      1. Here is a fix for this.
    3. Secure phpinfo.php with .htaccess
    4. Secure phpinfo.php with php

For debugging without checking error_log/access_log files

  1. create a file called phpinfo.php in your / directory
  2. the contents of phpinfo.php

    
    
  3. Use this for your .htaccess file.

    Options +FollowSymLinks
    ErrorDocument 404 /phpinfo.php
    

Now instead of getting a 404 error you will see debug information which will help you find out what the problem is.

Add security to phpinfo.php

Cd-MaN pointed out a security problem this method has, it reveals sensitive info to anyone who requests phpinfo.php.

Also, you better use it only as a temporary measure, because it reveals many sensitive information about your server (eg. delete it after you done debugging)

Here is a fix for this.

Secure phpinfo.php with .htaccess

This only allows the user from IP address 2.3.65.6, everyone else is redirected to http://www.domain.com

ErrorDocument 403 http://www.domain.com
Order deny,allow
Deny from all
Allow from 2.3.65.6

Secure phpinfo.php with php

Same thing only uses .htaccess. Change your phpinfo.php file to the following


Debug apache log files from php - AskApache

Charles Torvalds
8 Jan 2007

  • Site Map WireShark GNU Non-GNU Tor Project cURL TLDP - Documentation
  • Htaccess Files Hacking Htaccess Javascript Linux Optimization PHP Security Shell Scripting WordPress
  • Base64 Image Converter Raw HTTP Header Debugger Graphical ASCII Text Generator Mac Address Vendor Lookup Who Am I – Your IP Information Request Method Security Scanner .htpasswd file Generator Compress CSS DNS Tracer
Copyright © 2025 AskApache
  • Site Map
  • Htaccess Files
  • Hacking
  • Htaccess
  • Javascript
  • Linux
  • Optimization
  • PHP
  • Security
  • Shell Scripting
  • WordPress
  • Base64 Image Converter
  • Raw HTTP Header Debugger
  • Graphical ASCII Text Generator
  • Mac Address Vendor Lookup
  • Who Am I – Your IP Information
  • Request Method Security Scanner
  • .htpasswd file Generator
  • Compress CSS
  • DNS Tracer
Exit mobile version