Recently we have decided to install an independent counter for a site with SSL certificate. While it is quite simple to find a counter for a usual site, it’s hard to locate a free counter that supports SSL. The method I describe is not quite free, but you can continue using it after paying a small fee once.
I think nowadays everyone knows Statcounter. They offer free counters with basic stats. They don’t advertise the SSL support for websites, as it’s available only in the paid version of the site. The main difference of paid version is the increased log file size. But if you need SSL support, than you’ll have to pay for that.
The solution is quite simple – you can purchase an upgrade, get the code for installation and place it on your site. If you like the increased log file size, you can continue using paid version. If you don’t need it – just revert back to free version (but you will have the code).
If you can share any other method of putting a free counter with SSL support – let me know.
Sometimes you might need to include PHP code into HTML pages. For example, you want to include a menu, that is called via PHP in a static HTML page and you cannot rename your files into PHP for many reasons. I will tell you how to do this on a dedicated server and on a shared hosting account.
If you’re leasing a server, you need to edit your httpd.conf file. It is usually located at /etc/httpd/conf (if you have any non-standard server configuration – ask your server provider about the location). All you need to do is just to ass the following line to the bottom of the file:
AddHandler application/x-httpd-php .phtml
This line will tell your server to treat HTML files as PHP ones. If you are on a shared hosting, you should try to add the same line to your .htaccess file. But it is not convenient if you need to do this for entire account with multiple domains. In order to make it working on a shared hosting, you need to add a new MIME type (95% hosting service providers allow this). I will show you on a Netfirms account, but this can be done almost anywhere. You should contact your hosting provider and ask where you can modify MIME associations. Ok, let’s start with Netfirms.
Let’s go to the Control Panel
Scroll down to Additional tools->.htaccess editor.
Choose MIME Types
Add the line just as shown on my screen. You’re done.
This is not a trick, but a must for server security.
If you would like to limit your users’ ability to execute the code, located on remote servers, you should ensure your php.ini has the following lines:
Of course, this will not save you from insecure code, but this is one of the first steps you need to perform after server setup.