Archive for the ‘How to’ Category

Determine whether PHP is being run via HTTP or CLI – Follow Up

Wednesday, February 1st, 2012

As a quick follow up to yesterday’s post about how to determine whether PHP is being run via HTTP or CLI, I decided to do a quick post about where I found the values in the source code which are returned by the php_sapi_name() function and PHP_SAPI constant. I downloaded the PHP source code for [...]

Command line arguments for the PHP CLI

Wednesday, February 1st, 2012

The PHP command line interface or CLI allows you to run PHP scripts from the command line. It also has a number of flags that can be passed to it which allow you to see which modules are available, do a syntax check on a file, view PHP information etc. This post gives a basic [...]

PHP CLI counter for long running processes

Wednesday, February 1st, 2012

I’ve been doing a reasonable amount of PHP CLI (command line interface) programming recently for getting stuff from log files and converting large numbers of images. Some of these processes can some quite a while to run, sometimes as long as several hours, so it can be useful to know roughly how far through the [...]

Running PHP scripts as shell scripts

Wednesday, February 1st, 2012

As well as running PHP scripts via a web server such as Apache, you can also run PHP scripts from the command line (it’s also possible to write GUI apps with PHP using PHP-GTK, but I’ll maybe look at that another time). This post looks at the two ways you can run a PHP script [...]

Shell Script To Execute Command When Server Load Reaches Threshold

Wednesday, February 1st, 2012

Just wanted to share a script that I worked on, that is doing it’s job. I am sure that this can be done many other ways. However this is doing the job just fine. In my particular script we have a couple servers that sometimes the load goes super high and actually renders the server [...]

How to Cron Jobs In 5 Minutes working?

Sunday, January 8th, 2012

In Linux, the crontab command is used to schedule execution of commands at certain time intervals whether it be hourly, daily, monthly or every x amount of minutes. This article is designed to show you the simple way of understanding crontab. Understanding the fields: # (Use to post in the top of your crontab) # [...]

How to Install Internet Explorer on Linux / Ubuntu?

Thursday, December 8th, 2011

Someone would ask: “Why would I need IE on Linux cause I got the newest and best browser ever called Firefox already installed?” Sometimes the IE is necessary for web designers working on Linux to test their pages, or to browse sites that don’t open in any browser except the IE. Here I will explain [...]