The other day I decided to give MAMP Pro a go, so I installed it, setup my hosts and opened my Laravel PHP project.
This project takes data from a database, then spits out each row. Nothing complicated or weird happening within the codebase, so I was suprised when I saw that there was an error about a value not being set. The project worked when using the version of PHP which is shipped with my Mac and it definitely works whilst I'm in the office (albeit on my iMac).
After a bit of digging I found out that the MySQL driver
pdo_mysql is unable to return types, meaning that if you have a MySQL table which contains an integer and a string field type, that you'll only ever get a string result back.
1 will now become
How did this affect my project? It prevented all of my explicit conditions as
false. Certain parts of my UI were no longer showing due to these failing conditions.
The issue definitely lies within MAMP and the MySQL driver it contains, as after switching back to the shipped LAMP setup, everything continued to work.
I was able to fix this by removing MAMP and then installing a Homebrew version of PHP (
php55). And from there I could then install
php55-redis to get the
Redis class that I needed.