This discussion is archived
23181 Views 17 Replies Latest reply: Apr 8, 2009 11:57 AM by coyotesf
Currently Being ModeratedOct 30, 2007 10:52 AM (in response to ValGor)Hi,
I ran into this also. Oversight on behalf of Apple not to include MySQL PDO drivers. The quickest and dirtiest way I found to get past this is to install Marc Liyanage's PHP distribution for Apache 2. Out of the box this WON'T WORK. You have to move some files around.
1. Move Apple's php module out of the way.
sudo mv /usr/libexec/apache2/libphp5.so \
2. Move Marc's php module in.
sudo mv /usr/local/php5/libphp5.so \
3. Create the following folder:
4. Copy libexpat.0.dylib to the above folder.
This file comes as part of the Developer Tools (among other
things), so if you have Xcode installed, you should be able
to copy it from here:
5. Kick Apache
sudo apachectl configtest
sudo apachectl restart
Hope that works for you too.
Currently Being ModeratedDec 28, 2007 2:42 PM (in response to stewey)hi,
There are a lot of people who ran into this. So I was searching for a solution I saw this post and another on entropy.ch. When I try this solution Everything works and is loaded with the pdo_mysql driver. But the problem now is that when looking with phpinfo() the MYSQL_SOCKET is still on /tmp/mysql.sock. As I've found out this should be /var/mysql/mysql.sock.
When trying to connect with mysql with pdo I get an error
SQLSTATE[HY000]  Can't connect to local MySQL server through socket '/tmp/mysql.sock'
Does anybody know a solution for this.
Currently Being ModeratedJan 25, 2008 7:37 AM (in response to stewey)i got these errors when i switched them out...
bash-3.2# apachectl restart
bash-3.2# apachectl configtest
httpd: Syntax error on line 114 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/libphp5.so: no matching architecture in universal wrapper
bash-3.2#Mac Pro - Macbook Pro, Mac OS X (10.5.1)
Currently Being ModeratedJan 25, 2008 8:33 AM (in response to windhamd)and i believe it is something to do with the 64 bit architecture on the G5.. I could not duplicate the error on my intel macbook.G5 - Macbook Pro, Mac OS X (10.5.1)
Currently Being ModeratedJan 25, 2008 11:13 AM (in response to stewey)ps.... don't do this without a backup of the libphp5.so ... and it doesn't work on leopard on a G5 with 64 bit architectureg5 - Macbook Pro, Mac OS X (10.5.1)
Currently Being ModeratedFeb 7, 2008 10:11 AM (in response to windhamd)So is there a solution to this? Have any of you guys been able to get this running? I need to test Habari blog on my mac dev env and have the same issue.160gb MBP, Intel Core 2 Duo, 2.4Ghz, 4GB Ram, Mac OS X (10.5.1)
Currently Being ModeratedMar 5, 2008 6:54 PM (in response to windhamd)actually I'm getting this exact error on my new mbp ...
anybody have a solution yet that doesn't involve re-compiling anything ?
I need this for work pretty bad and don't have the time to fiddle with compilations.macbook pro, Mac OS X (10.5)
Currently Being ModeratedApr 7, 2008 1:28 PM (in response to elpepelucho)I'm having the exact same problem as you. As far as I can tell, the only way to enable PDO_MYSQL in PHP is by recompiling with appropriate configuration options.
Like you, I'm not sure how to do this and would appreciate a simple explanation of how to :
1) Locate the PHP binaries (I'm using PHP 5.2.5)
2) Do the unix stuff to recompile with the appropriate configuration options.
If anyone can help someone who is very rusty when it comes to unix I'd really appreciate it.MacBook, Mac OS X (10.5.2), PHP 5.2.5
Currently Being ModeratedApr 18, 2008 3:07 PM (in response to ValGor)Is there a resolution to this without resorting to rebuilding PHP/Apache and Mysql. This is something that should be addressed with an update from apple allowing for the default versions of php etc to be used. I just got my mbp with the sole purpose of developing in PHP which is what I do for a living, so far its been no use (£1300 paper weight). Not being funny but it really is all it will be used for. I just spent seven hours looking for a solution to this problem and from what I can see a lot of other people have spent even longer. I must admit I'm gutted I cant use it, I look forward to getting a solution to this
I just hope it doesn't take too long. I use pdo_mysql and the gd extensions, I just migrated from windows which has an excellent php installer that allows extensions to be added and removed at will. This is what we need for the Mac.MacBook Pro, Mac OS X (10.5.2)
Currently Being ModeratedMay 31, 2008 1:06 AM (in response to ValGor)I have managed to get PDO with MySQL support.
I installed the latest Marc Liyanage Beta from here:
sudo mv /usr/local/php5 ~/Desktop/php5.old
curl -O http://www2.entropy.ch/download/php5-5.2.5-6-beta.tar.gz
tar -xzf php5-*-beta.tar.gz
sudo mv php5 /usr/local/
sudo chown -R root:admin /usr/local/php5
sudo ln -sf /usr/local/php5/entropy-php.conf /etc/apache2/other/+entropy-php.conf
then comment the existing php module in httpd.conf
#LoadModule php5_module libexec/apache2/libphp5.so
the entropy build adds a conf to 'other' if you install it as above, that loads the module from the /usr/local/php5 directory
(I did it this way so future upgrades are easier and the built in php remains untouched)
enable the php.ini in /usr/local/php5/lib/
edit the msyql socket connections there.
mysql.default_socket = /var/mysql/mysql.sock
(because I'd previously followed these instructions: http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-1 05/)
*watch out for short php tags* - they're disabled in this php build.
the final workaround I had to do for PDO to work properly was to include the socket in the connection string:
I now have a working PHP installation with support for PDO and a bunch of other libraries on OSX 10.5.3 on a Mac Pro (2x2.66 Dual-Core)
Hope this helps someone (and I didn't leave out any steps)Mac Pro, Mac OS X (10.5.3)
Currently Being ModeratedMay 31, 2008 7:02 AM (in response to boldfysh)Further to the above - messing with the MySQl socket location is a bad idea.
better to leave it where it is (don't edit /etc/my.cnf) just edit the php.ini to point to where leopard wants its MySQL socket. /tmp/mysql.sock and then you won't have to worry about PDO_MYSQL not finding it, nor Perl modules etc.
http://www.beyondmac.com/2007/10/30/php-mysql-on-leopard-mysqlsock-location/Mac Pro, Mac OS X (10.5)
Currently Being ModeratedJul 17, 2008 7:38 AM (in response to boldfysh)Thanks much. I spent whole day trying all the other options mentioned here and elsewhere. This works very well and straight forward.Macbook, Mac OS X (10.5.4), Intel 32 bit
Currently Being ModeratedOct 10, 2008 5:14 PM (in response to boldfysh)Hi there,
I had Apache2/PHP5 working just fine with Leopard, but needed the PDO_mysql extension so decided to give Marc's PHP5 module a try.
I tried the following steps but now my Apache2 server is totally dead. Won't even serve up a static image file I'm wondering if it's because before running the installer, I didn't see the note about commenting out the line in my httpd.conf file which loads libphp5.so. However, I commented that line out AFTER running the installer, but it still didn't work. Also tried re-running the installer again after commenting that line out, but still no luck.
If I go back into my httpd.conf and uncomment the libphp5.so line, everything works fine with my old PHP5, but that doesn't really get me any farther ahead
Here are the steps I followed:
1. cd /usr/local
2. sudo curl -O http://www2.entropy.ch/download/entropy-php-5.2.4-1-apache2.tar.gz
3. sudo tar -xzf entropy-php-5.2.4-1-apache2.tar.gz
4. double-clicking entropy-php.mpkg and following the instructions
Marc's instructions seem to be for 10.4, so I'm wondering if I need to do anything special to get it to work on 10.5?
DaveMacBook Gen3, Mac OS X (10.5.5)
Currently Being ModeratedOct 10, 2008 6:10 PM (in response to dkoo761)UPDATE: In Googling around, it looks like Marc's PHP module doesn't work on Leopard. Bummer....I guess it's off to the MAMP world. Or perhaps sucking it up, getting off my lazy arse and compiling PHP from sourceMacBook Gen3, Mac OS X (10.5.5)