I have just installed Snow Leopard and now my PHP/MySQL program ends in a "Segmentation fault". I have been searching the web for a solution, I realize that there are some issues with SL/PHP/MySQL, but I have not found anything that works yet.

I downloaded the binary MySQL package mysql-5.1.42-osx10.6-x86_64. I have updated the php.ini file as suggested at various posts.

When I run PHP and connect to the MySQL server the behavior is a bit random. In many cases it works fine to connect and read data. In my specific case the PHP program constructs a

LOAD DATA LOCAL INFILE ...

statement to load data from a text file. It should do several such queries after each other in a loop. It works one time but the halts in a "Segmentation fault". The program worked fine in Leopard, but not now.

My versions are: OS 10.6.2, PHP 5.3.0, MySQL 5.1.42

link|improve this question
Is it only your script that ends in a segfault? I've seen some PHP installations where any script segfaults after execution (e.g., php -r '$x = 1;') – Frank Farmer Jan 19 '10 at 20:45
Is your OS 64 bit ? – Olivier Lalonde Jan 19 '10 at 20:49
Frank: Many scripts work, also scripts including connections to MySQL, but not this specific script. Olivier: I have a MacBook Pro with 2.53 GHz Intel Core 2 Duo, I guess it should be 64 bit. – Peter Jan 20 '10 at 7:43
feedback

migrated from stackoverflow.com Jan 20 '10 at 11:45

This question came from our site for professional and enthusiast programmers.

5 Answers

Maybe this blogpost from Rob Allen will be helpful? http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-6-snow-leopard/

link|improve this answer
feedback

Just a hunch, but I would try installing the 32-bit version of mySQL to see if it solves the problems. I remember having issues with mySQL drivers not working with the 64 bit version (either in PHP or Ruby, I don't remember which).

link|improve this answer
feedback

I have now tried different installations of MySQL (10.5, 10.6, 32 bit, 64 bit) but still not working.

I have also rebooted the Mac into 64 bit mode after reading this http://www.9to5mac.com/snow-leopard-64-bit-32-bit-firmware-efi . Still not working.

I also tried setting the extension_dir in php.ini according to http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-6-snow-leopard/ . Still not working.

When I do

php -i | grep API

I see

Server API => Command Line Interface
PHP API => 20090626
Zend Extension Build => API220090626,NTS
PHP Extension Build => API20090626,NTS
DOM/XML API Version => 20031129
API Version => 3001
Client API version => mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27 $
Client API library version => mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27 $
Client API version => mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27 $
Phar API version => 1.1.1

Could the "mysqlnd 5.0.5-dev" be the problem?

link|improve this answer
feedback

I am working with Xampp on mac (http://www.apachefriends.org/en/xampp.html) without issues. Maybe it helps installing xampp. Just my 2c

link|improve this answer
Thanks, I will look into this. – Peter Jan 20 '10 at 11:00
feedback

I finally got the time to look at XAMPP. I installed the latest version, updated the $PATH variable to include XAMPP, changed /usr/bin/php to point at PHP under XAMPP. Now it works again!! Thanks!

link|improve this answer
feedback

Your Answer

 
or
required, but never shown