Php: page 6
Installing APC and Memcached for PHP Sessions on Ubuntu and Debi…
Installing APC on Debian or Ubuntu is as simple as: **user@server:/directory/$** sudo apt-get install php-apc Now let us reboot the Apache process to enable our new cache: **user@server:/directory/$** sudo /etc/init.d/apache2 restart APC should now be ready to run on your server. Try running the following command to verify it is setup; you should get something in response like mine: **user@server:/directory/$** php -r ‘phpinfo();’ | grep ‘apc’ apc MMAP File Mask => /tmp/apc. Read more ⇒
Using phing for good - Unfuddle Add Repository and SVN Import Ta…
As you may be aware I have recently been playing with the excellent Agavi framework and it introduced me to the interesting phing tool. Phing can be used to automate tasks with build files that are close to interoperable with Apache Ant, which uses XML files to configure builds. The advantage phing has for us PHP users is that it is entirely written in PHP so extending it is as simple as adding a new class. Read more ⇒
Installing APC and Memcached for PHP Sessions on Redhat
Installing APC on Redhat is as simple as: [user@server directory]# yum install php-pecl-apc APC should now be ready to run on your server. Try running the following command to verify it is setup; you should get something in response like mine: [user@server directory]# php -r ‘phpinfo();’ | grep ‘apc’ apc MMAP File Mask => /tmp/apc.s5jA6w apc.cache_by_default => On => On apc.coredump_unmap => Off => Off apc.enable_cli => On => On apc. Read more ⇒
A bit slow off the mark with this one but Agavi 1RC1 has been released and it is of course looking very nice. The 1.0 feature set is complete and potential bug fixes are the only things standing between now and 1.0 in earnest. Features that I am particularly interested in include the recent refactoring of the configuration/routing files, the new validation interface and the addition of unit testing to the framework. Read more ⇒
To install the new XAMPP ensure you firstly uninstall and remove your current XAMPP folder. Upgrades are not supported with this version due to the differences one of which is the removal of PHP4 support from the XAMPP package. I like to install agavi via the pear package that is available: Open a command prompt and navigate to your XAMPP directory eg. D:\xampp\php Execute: pear channel-discover pear.agavi.org pear config-set auto_discover 1 pear config-set preferred_state beta pear install -a agavi/agavi Wait for a bit as it installs Read more ⇒
Freelancers: Costing your work
Recently I have been a fly-on-the-wall in an interesting discussion on the Auckland PHP User Group regarding the process of costing freelance work. So I thought I would toss my hat in the ring and give my opinion and summarise the interesting aspects. Let me just say now that I cannot tell you how much you should be charging or what you are worth, but I can help you avoid some pitfalls. Read more ⇒
A few common PHP mistakes: Using require_once when a simple require would achieve the same result. Using require uses less system resources and therefore executes more quickly. You should engineer your code so you don’t need to use require_once. The same of course applies to include statements. Failing to declare variables before attempting to use them. Don’t use absolute paths and URLs where relative will suffice Not opening code for peer review. Read more ⇒
SQL Server 2005 Dump to SQL statements
Say you have a development environment setup using SQL Server 2005 Express Edition and your customer has a SQL Server 2000 database accessible only via ODBC and you can only run a DB import via a script. How would you do it? Easy you might think just run msdbdump.exe on the command line, well this isn’t MySQL so you are not so fortunate. Backing up your DB is easy with SQL Server using the following commands: Read more ⇒
Geographic Calculations in PHP
warning This library is now deprecated in favour of my new Navigator library. Please use it instead - its much better, tested and makes use of newer PHP features! Recently I have been involved with a project that maps yachts during an ocean race, which got me thinking about basic calculations and conversions that would be useful to fellow developers. I envisage this being useful in projects leveraging Google or Yahoo maps. Read more ⇒
Form SPAM (not "HAM") fighting tips
A site that I have up called Alfa Romeo Sprint QV has recently been the target of malicious spammers and/or their robots. The messages mainly consisted of porn and poker sites. Now the script used to generate the Your Sprints section of the site was written a long time ago when spamming forms and blogs was not a common occurrence and my site had a relative small readership and no Google rank or anything like that. Read more ⇒