April 1, 2010
In our company I’ve become the unofficial “Framework Tester Guy”, because I always seem to be the one working on the latest version of our internal framework. Recently I decided to try out an established framework to develop a little personal project of mine. I picked cakephp for several reason.
I run Windows 7 on my home system and I couldn’t find a nice quick guide on setting up the cakephp console on windows 7 in a text format. Sure, there are screencasts, but sometimes having nice step by step text instructions is just easier, especially when your internet connection is acting up a bit and you can’t stream effectively (like when you stay in South Africa). So here are some quick and easy steps to set up the cakephp console in windows 7 on a WAMP server.
March 18, 2010
This is something that a number of people I know have struggled with, so I hope to help out with what I have learned.
To connect your PHP program with MySQL is probably step two for any PHP developer and it’s very easy. In principle, connecting with SQL Server (Microsoft SQL) should also be easy, but when most people have their first go at a MSSQL connection, they just get the following:
SQLSTATE unable to connect:
sql server is unavailable or does not exist.
The thing is, PHP and it’s MySQL buddy are both free and they like each other, so if you install a new Apache server (or similar) its already set up to run MySQL connections without problem, but it’s not the same for MSSQL.
Here is a list of things you need to change in your setup to be able to open a MSSQL connection with PHP:
February 26, 2010
There are a few places where this issue has been addressed, but I thought I’d share it with the masses anyway.
I’ve been using an in-house framework for a couple of projects but this is my first time using CakePhp on a project, so I’m certainly no expert and there might well be more efficient or easier ways to do what I’m describing below. With that being said, I came across a small problem while setting up a login script…
February 24, 2010
I created a restricted file download area for a client website, for their clients to download spreadsheets from their site. A problem arose where I got an error message (in Windows) when opening the file directly in Internet Explorer 6, and choosing ‘open’ instead of ‘save’ on the File Download popup. But when opening the same link in Firefox, it opens successfully! This is the error message one gets:
‘C:\Documents and Settings\\Local Settings\Temporary Internet Files\Content.IE5\’ could not be found
It also seems to be an issue in some other Microsoft software (such as Outlook) as well. The error was not given in Internet Explorer, but in whatever program is set to open the file, such as OpenOffice or Excel. The error message differs a little according to the program used, but the problem is that the temporary file cannot be found.
February 23, 2010
This error came from executing this line of code, when uploading an image jpg and then working with it with the PHP GD2 Library:
$im = @imagecreatefromjpeg($file);
The problem is that newer versions of PHP result in an unrecoverable error if you reference a wrong file, or non-jpeg file, according to the manual it is supposed to simply return FALSE, but it does not! The fix is easy, but tedious:
March 4, 2009
I’m working on a wamp system, and have started playing around with sockets. I enabled sockets via the wamp interface:
wamp : PHP settings : PHP extensions : php_sockets
and could run my php file via my browser.
When trying to run the same file via the command prompt (start : run : cmd), I got the following error:
Fatal error: Call to undefined function socket_create() in … on line …
February 19, 2009
According to the MySQL manual
Full-text indexes can be used only with MyISAM tables
I’m using an InnoDB table-type however, so had to look at other ways of implementing a full-text search that would give me rankings by relevance, to order the results by.
It’s possible to do the ranking with PHP, by doing a
LIKE '%term%' MySQL query and then doing a substring count for each search term, but I believe that doing it via MySQL would be faster, and way cooler.
February 19, 2009
I was setting up a database query using a PDOStatement, by looping through an array of values and binding each parameter seperately. But on executing the query, I got the following error:
Fatal error: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY000]: General error: 1452 Cannot add or update a child row: a foreign key constraint fails (`places/places`, CONSTRAINT `places_ibfk_3` FOREIGN KEY (`login_id`) REFERENCES `login` (`id`) ON DELETE CASCADE)’ in G:….