Monthly Archives: December 2010

Make PHP and MySQL communicate on Mac OS X 10.6 Snow Leopard

I write this blog post because every few months I need make PHP and MySQL work on Mac OS X and every time I have to figure it all out again. Time to write it down…

The following instructions consider Mac OS X 10.5 and 10.6 (Leopard and Snow Leopard).

Almost always people start shouting “MAMP!” as soon as people have problems with PHP and MySQL on Mac OS X. It is nonsense to install MAMP on a Mac because almost everything is already installed on your Mac. Why would you install all necessary server software twice? It just takes away hard disk space. You really don’t need to use MAMP. All you need is to figure out how to configure PHP and MySQL.

Obviously, before PHP can work with MySQL, you need to install MySQL. You can download MySQL for Mac OS X here http://www.mysql.com/downloads/mysql/ . Install MySQL and don’t forget to install the preferences panel that comes with it.

Now you can activate PHP. Type command-shift-G in the Finder and type /etc/apache2/ in the little window that appears. Click on Go en find the file httpd.conf in that folder. Copy this file to the desktop and create a backup copy named httpd.conf.old.

Open the file httpd.conf in TextEdit and search for the line containing

#LoadModule php5_module libexec/httpd/libphp5.so

Remove the # and save the file. Copy the modified file to /etc/apache2/ en cofirm if you are asked whether you want to replace the existing file.

When PHP tried to communicate with MySQL, it uses a socket file to contact MySQL. PHP expects o find this file in /tmp/mysql.sock while MySQL puts the file into /var/mysql/mysql.sock. It has been like this for year and I really don’t understand why the two parties involved don’t solve this.

The “temporary”solution is to tell either PHP or MySQL to create or search the socket file somewhere else. The easiest way (in my personal opinion) is the following.

1) open TextEdit and type the following four lines:

[mysqld]
socket=/var/mysql/mysql.sock
[client]
socket=/var/mysql/mysql.sock

2) Save this text file at the location: /etc/my.cnf

You may be unable to save the file in /etc right-away. In this case, you can save the file on your desktop first. Type command-shift-G (in the Finder) and type /etc in the little window that appears. If you click on Go, you will see a Finder window displaying the content of folder /etc. Now you can copy the file my.cnf to the folder /etc. You may need to enter your admin name and password when you copy the file.

Now you need to turn off and on Web Sharing in the System Preferences. You may need to turn off and on MySQL too, which you can do in the MySQL preferences panel.

PHP should now be able to use MySQL.

An AppleScript alternative for the HyperCard flash command

Remember the HyperCard flash feature? It would invert your screen for a split second and then return to normal. Here’s how to do exactly the same with AppleScript.

tell application “System Events”
    tell application processes
        repeat 2 times
            key code 28 using {command down, option down, control down}
            delay 0.2
        end repeat
    end tell
end tell

Store the script in a custom property of your LiveCode stack, for example cInvertScript. Then run the script as follows:

do (the cInvertScript of this stack) as AppleScript

Isn’t that cool?!

Installer Maker Plugin 1.5 for LiveCode is now available!

Economy-x-Talk is pleased to announce a big update of the now well-known Installer Maker Plugin for LiveCode.
The Installer Maker Plugin is the easiest way to wrap your LiveCode standalones in an installer. Just create your standalones and drag them into the Installer Maker Plugin window. Without being complicated, the Installer Maker Plugin offers you sufficient options to install your software on almost every Windows PC or Mac.

The new update contains more than a dozen bug fixes and new features. Most of the implemented new features were requested by our customers. Some important changes are: deletion of pictures from the Appearance section is now possible, more and improved language options, parenthesis are now allowed in file paths, more built-in checks and fail-safes to avoid mistakes.

Screen_shot_2010-12-13_at_16

With this new release, we are adjusting our licensing policy to make continuation of this project possible. We provide everyone who buys a (new or upgrade) license with free updates for three months. Currently, everyone can buy an upgrade, regardless of when you bought your license. Soon, you will be eligible for the upgrade price only if you bought your original license less than 1 year ago.

If you bought your license more than a year ago, you might want to buy an upgrade right now, while you can still pay the upgrade price. Upgrades cost EUR 16.95, new licenses cost EUR 39.00. (You can see when your license was created by hovering your mouse over the version number in the bottom-left of the Installer Maker window. The license creation date will appear in the tooltip.)

The new version of the plugin and forms to buy a new license or an upgrade can be found at http://rrinstallermaker.economy-x-talk.com . If you have any questions, please go to http://qurl.tk/du and fill out the web form.