Monthly Archives: November 2014

Throw scripts as text instead of executing it

To throw PHP or other scripts as text instead of executing it, add the below code to .htacess file.

AddType text/plain .cgi .php .php3 .php4 .php5 .phtml .pl .py .pyc .pyo .sh .html .shtml .jsp

This method can be used to execute .html files as .php (or for executing any other type of file as some other type).

This requires mod_mime module of Apache to be installed and enabled.

There might be problem if su_php is enabled. In case the above doesn’t work for PHP scripts when suPHP is enabled then try adding the following to Apache Directives (main is the highlighted code).

<Directory /var/www/domain.com/files/images/>
        suPHP_Engine off
 </Directory>

It is not a good idea to disable suPHP for the whole site, instead disable only for the required directory.

Apache, Make Shared Hosting (single) IP open a particular domain

This is based on Apache on Ubuntu.
The server has a single IP Address and is used to host multiple domains using VirtualHost
If it is needed that on using the IP address of the server (in a browser) a particular site/domain get opened, then do the following:

  • Create a vhost file with the IP address as name e.g 192.168.0.1.vhost
  • Add the necessary VirtualHost configuration. It can be copied from the domain’s vhost file
  • The ServerName in the vhost file will be the IP. e.g. ServerName 192.168.0.1
  • Create a link of the vhost inside sites-available folder to a proper file in sites-enabled folder. e.g.
    ln -s /etc/apache2/sites-available/192.168.0.1.vhost ../sites-enabled/192.168.0.100.vhost
  • Restart apache

Please note adjustments might be necessary in the .htaccess file. Like if non-www to www redirection is enabled or http to https redirection is enabled, they will give error and warning (respectively) when IP is used to access the site. Adding

RewriteCond %{HTTP_HOST} !192\.168\.0\.1

before the existing condition ( e.g. RewriteCond %{HTTP_HOST} !^www\. ) should help.

PHP Microframeworks

Below is a list of some PHP Microframeworks

  • Epiphany
  • Flight
  • Fat Free
  • Silex
  • Slim
  • BulletPHP
  • Limonade
  • Phalcon
  • Recess PHP
  • Tonic
  • Wave Framework
  • Zaphpa

Though all have their own merits and demerits but Phalcon is the most recommended one for speed and Slim and Flight for ease and speedy learning. In general Slim seems to be the most preferred one and has quite some handy features.

Trends in PHP based CMS

WordPress seems to be gaining up and looks like it will do so for some time more.

Search Trends for WordPress, Drupal and Joomla


Search for WordPress by Country

Search for Drupal by Country

Search for Joomla by Country