Category: PHP
Using multiple database connections with Yii framework
There may be occasions where you will need to set up database connections to more than one database. This guide will show you the easy way to set up these resources. In your main.php config file, you may already have a db component set up by default. //.. main.php ‘db’=>array( ‘connectionString’ => ‘mysql:host=localhost;dbname=testdrive’, ‘emulatePrepare’ => [...]
Calculating the radius of a coordinate using PHP
Sometimes you’ll want to get the radius of a location. For this I have written a function that I’ll share with you. /* Copyright 2009 Kevin Bradwick (http://www.kevinbradwick.co.uk) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software [...]
How to install LibSSH2 on a CentOS 5 system
Libssh2 is a C library implementing the SSH2 protocol for PHP. Here’s how to get it installed on a CentOS system running PHP 5.1.6. First step is to install some dependencies. yum install automake php-devel libtool openssl-devel gcc++ gcc Next, let’s download the latest release of libssh2 (1.2.2 at time of writing), unpack and install [...]
Accessing a timezone list in PHP
The php function timezone_identifiers_list is only available in newer versions of PHP (typically 5.2+), although the php site suggests it is available in versions 5.1.0+. If you have CentOS (current version 5.4) or another linux distro that has 5.1.6 or similar, you may find the function does not exist. For these situations, I have compiled [...]