PHP CLI counter for long running processes

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 process it is.This post looks at how to output a counter to the command line from PHP which replaces itself on each iteration.

Categories PHP

Sending email with Zend_Mail

The Zend Framework is a PHP framework with many individual components that do not require you to use the whole framework. In this post I will look at how to send an emailusing the Zend Framework’s Zend_Mail component.

Categories PHP

Using the FCKEditor HTML Editor with PHP

FCKeditor is an in-browser WYSIWYG HTML editor and I use it on a number of websites including in the blog admin for this website. This post looks at how to put FCKeditor into a web page using PHP. In future posts I will look at some of the other functions and features of FCKeditor.

PHP Date Constants

When writing my "Get a list of all available constants with PHP" post I discovered there are a number of usful date format constants in PHP which can be used with the date() function. (Refer to my "Formatting Dates with PHP" post for more details about the PHP date function). This post looks at these constants and how to use them with the date function. Please note that these constants have only been present in PHP since 5.1.1.

Categories PHP

303 redirect with PHP

When you submit a form using a web browser the script processing the form often redirects after it has done its work to a thank you page (or similar). The response type people usually use when coding with PHP is a 302 redirect because it’s the default used when issuing a Location: header. The problem with this is on a page refresh the browser is likely to submit the form again. Instead you can use a 303 redirect to prevent the form being submitted again. This post looks at what a 303 response code / redirect is and how to send one with PHP.

Categories PHP