Category Archives: web

How to display PHP errors only in public_html directories

How to display PHP errors

I always use servers where PHP errors are not shown by default and I always forget how to enable error messages in development environments.

My situation

On a server I usually prefer Debian OS, but when I develop on the go I use laptops with Ubuntu.
In this case I’m running Ubuntu 14.04 LTS with Apache2 (v2.4.7) and libapache2-mod-php5 (v5.5.9).

I want PHP errorors displayed for projects in my public_html folder.

Solution 1 (only Apache conf files)

Create the file /etc/apache2/sites-enabled/800-public-html.conf with this content:

<Directory /home/*/public_html>
  AllowOverride Options
  php_admin_flag display_errors On

Solution 2 (using .htaccess)

Create the file /etc/apache2/sites-enabled/800-public-html.conf with this content:

<Directory /home/*/public_html>
  AllowOverride Options

Create the file /home/max/public_html/project1/.htaccess with this content:

php_admin_flag display_errors On


It’s easy and easily forgettable. Don’t forget to add

error_reporting(E_ALL | E_NOTICE);

in your .php files.

Run Chrome with out of date plug-ins

Plug-ins which run inside Google Chrome don’t automatically update and so they may get outdated over time. When an outdated plug-in is called inside a HTML page, Google Chrome detects that it’s out of date and a message will appear informing you that the plugin has been blocked.

An unsafe solution to the problem is to run Google Chrome with a special argument:

chrome --allow-outdated-plugins


Markdown Viewer Firefox Extension Screenshot

Markdown Viewer Firefox Extension

I’m spanning the use of Markdown in every place I can: project documentation, blogging, note taking etc.

A useful Firefox extension I found is Markdown Viewer. It let you view Markdown files, HTML formatted, directly in the browser window. It’s useful when you have md files on the local filesystem that you want to quickly preview.

Problem: Firefox tries to download every .md file

I found a really annoying problem using this extension and I’m going to describe how I solved it: let’s say I have a file called in my home directory (/home/max/, I should view that file in Firefox visiting the url file:///home/max/
At this point Firefox wants to download it and there’s no easy way to force it to use the extension.

The solution is to edit a configuration file

$ vi ~/.mozilla/firefox/*.default*/mimeTypes.rdf

and add a text/plain dedicated area with the md extension specified:

<RDF:Description RDF:about="urn:mimetype:text/plain"
    NC:description="Text Document">
  <NC:handlerProp RDF:resource="urn:mimetype:handler:text/plain"/>

The last thing is to restart Firefox and everything should now work.

My set up

Just a side note: I’m running Ubuntu 13.10 with Firefox 26.0 and Markdown Viewer 1.3.


The comments on the extension page.