Ask AFP548 December 6, 2005 at 4:30 pm

PHP / MySQL Issues on Tiger Server

Some of you may be familiar with CMS solutions like Mambo and Joomla. Very cool, very easy to set up etc. Until you get to Tiger.

Well go to do that on a Tiger Server and am running into an issue between PHP and MySQL. I can login into MySQL, create a database, assign privs etc. When I got to link the db to Joomla, the PHP says the username and password are wrong.

This is using MySQL 4.1 and the default install of PHP on 10.4.3. I came across some postings about the socket location changing from /tmp to /etc, but nothing real concrete. One suggestion was to move to PHP5.

Any thoughts?

Read on for thoughts on a solution…Your thoughts on the socket are heading in the right direction. What you’re actually missing, I believe, is in your /etc/php.ini file.

Look for the line in /etc/php.ini which currently probably looks like:

mysql.default_socket =

This should be changed to read something like this:

mysql.default_socket = /var/mysql/mysql.sock

No Comments

  • I do not (yet) have access to Tiger Server, but try to find out with which
    MySQL Client Version PHP was compiled. This info should be included
    somewhere in the output of phpinfo(); (mysql > Client API version)

    MySQL did change the way password are stored somewhere between 3.x and
    4.1.x. I had a similar problem when using MySQL 4.1 and PHP 4.x from on a client Mac OS X 10.3.x. PHP was compiled with the mysql API
    from 3.x and was thus not able to authenticate with the newer password

    My solution was to re-assign the password in mysql in the following way:
    SET PASSWORD FOR user@localhost = OLD_PASSWORD(‘******’);
    This forces MySQL to use the older (weaker) algorithm to store password, but
    it can again be understand by older mysql-clients.

    Good luck,

    • That did it for the db I created and all was well in the Universe…

      Thanks one and all.

    • The php.ini file has empty specifications for the default socket and the default port number for MySQL. This is true, also, in Snow animal 10.6.x. Actually, I;m a little surprised that the php.ini has those fields blank. It certainly is an impediment to plug and play behavior. It does benefit a php programmer, though, to read through the php.ini file to know better what is up with the php setup on a particular server.

  • A possible cause…

    MySQL 4.1 and up use a new kind of password hashing that breaks a lot of
    programs including mysql functions in php. MySQL can be set to use the old
    style password hashes however.

  • Also you can check this issue at Apple Support Web Site. Look this:

    • You need to send a MySQL command to use the old passwords. This is because Apple preloads MySQL 4.1 and PHP 4 which are not compatible unless you tell MySQL 4.1 to use the old passwords.

      mysql -S /tmp/mysql.sock -u root -p
      -> give password
      ->SET PASSWORD FOR ‘root’@’localhost’=OLD_PASSWORD(‘passwd’);

      Alternatively you can installed PHP 5 (we have an easy way to do that in the Forums under Special Ops). However, not all PHP software is compatible with PHP 5. Joomla and Mambo will not give you problems with it, but others will such as Sugar CRM. I prefer to run my own MySQL rather than Apple’s as MySQL is now up to 5.0.16 which runs perfectly well with every PHP app I try but older versions of PHPList.

      Note that MySQL commands from 4.1 and higher can be quite different from the older versions so be careful with exporting and importing databases.

      I also recommend using the MySQL Administrator for Mac OS X along with phpMyAdmin 2.7. They are both excellent tools for this stuff.

      • I tried to update the mysql to permit the old passwords, but the

        <i>/tmp file doesn’t exist and using mysql -S /var/mysql/mysql.sock -u root -p</i>

        results in an error 1045 (asccess denied for user ‘root’@’localhost’.

        Do I need to sudo this command?

    • You saved my day! I have been struggling to get our WebCalendar (http:// to work after upgrading the server from
      Panther to Tiger.

      Changing the socket location as per the Apple Support article did the trick.

      Thanks for the great site – so often it is the only place that has the answers I’m
      looking for.

  • Apple has now fixed this problem as of version 10.4.4.

    "Addresses issues with the default interaction between the versions of PHP
    and MySQL that are pre-installed on Mac OS X Server, as well as addressing
    issues preventing seamless interaction between MySQL and the Apache web
    server. For more information on these MySQL issues addressed in the Mac
    OS X Server 10.4.4 update, please see this article."

    On the Apple site, that paragraph links to:

    • It broke our use of osCommerce badly. Was working fine in 10.4.3, but the update to 10.4.4 has the error

      Warning: mysql_connect(): Access denied for user ‘cust’@’localhost’ (using password: YES)

      cropping up. Have explored the various mysql dirs and find that mysql.sock is in the /var/mysql

      Since the faliure is global on the server for multiple VH domains, where do I find the proper php.ini file to mod, or is this something different?

Leave a reply

You must be logged in to post a comment.