Install PHP IMAP on CentOS

If you are getting the "Fatal error: Call to undefined function imap_open()" error in PHP when using the IMAP functions then they are not installed with your installation of PHP. This post looks at how to install the PHP IMAP functions on CentOS and should also work for Red Hat Enterprise Linux (RHEL), Fedora and other derived Linux distros.

Running PHP scripts as shell scripts

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 from a *nix based computer (Linux, Unix, BSD, OSX) and the single way you can do it from Windows.

Categories PHP

Get the first sentence with PHP

Sometimes you may need to get the first sentence from a block of content for use as e.g. the meta description for a page. This post looks at how to get the first sentence using PHP.

Categories PHP

Using the Zend_Registry in PHP

The Zend Framework has a component called the Zend_Registry which allows you to store data into a sort of global space which lasts the duration of the script. Once saved to the registry the data is available throughout the application. This post shows how to save some data to the registry and then retrieve it.

Categories PHP

Using the is_callable function in PHP

The PHP function is_callable() tests to see if a function or class method can be called, and solves an issue with the method_exists() function which will return true for all methods regardless of whether or not they can actually be called.

Categories PHP