MySQL error installing Drupal

Scott Haneda talklists at newgeo.com
Thu Jan 14 02:03:42 PST 2010


Ok, lets take a step back and see if we can clear this up.  

At some point, you installed MacPorts, and now you are running commands that you desire to call to the MacPorts installed applications, but we are not sure that is the case or not.

A few useful things that you could show us:

    $which -a php

This will show what your shell knows about the locations of php, in order, for all of them.  In my case, I see:

    /opt/local/bin/php
    /usr/bin/php

This tells me, when I type `php` on the command line, that it really is going to run `/opt/local/bin/php`. ( The first one in the above results )

This may also be helpful to others here who will help you:
    $which -a httpd

The order in which your system is searched for these files in controlled by your PATH environment variable, which you can get to by entering in:

    $echo $PATH
    
Mine returns something like this:
/opt/local/bin:/opt/local/sbin:/Users/me/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

If you look in your home dir, you should see that MacPorts has added a config file to add to the $PATH for you.  It is usually at ~/.profile.

If your `echo $PATH` command does not have /opt in it, there is a source of problem there that we need to solve first.

Finally, type the three letters `ENV` into your terminal, and show that output as well.

With all that, I think we should be able to help you from there.  More comments inline below...


On Jan 14, 2010, at 12:47 AM, Jasper Frumau wrote:

>> Which PHP is your web server using -- Apple or MacPorts?
>> 
> 
> @ http://localhost/drupal-6.15/info.php PHP 5.3.0 is indicated and
> mysql.sock is still not defined so I guess I have two PHP versions? How did
> that ever happen? If this is the Apple or MacPorts one I do not know..

It should be pretty easy to tell, one way, go into your System Preferences, and open up the Sharing Preference Pane, is Web Sharing turned on?  If it is, you have an instance of Apple's Apache running.

You can turn it off, but I am going to bet you break any sites you currently have running by doing so.  But it should not be too hard to get them back up and running.  If they were running under Apple's Apache, they certainly will run under MacPorts build of it.

>> Which PHP are you using on the command line -- Apple or MacPorts?
> 
> How do I check that? php -i shows the one phpinfo shows on the localhost
> with phpinfo();

The version number returned from php -i would be a good start, Apples and MacPorts are more than likely different:

MacPors Version (You may have a slightly different version)
    $/opt/local/bin/php -i | grep 'PHP Version'
    PHP Version => 5.3.1
    PHP Version => 5.3.1
    
Apple's Version (Snow Leopard)
    $/usr/bin/php -i | grep 'PHP Version'
    PHP Version => 5.3.0
    PHP Version => 5.3.0

But that is not the best test, since there is always chance of version parity. Probably the most telling, is going to be to run `php` with no direct full path, as so:

    $php -i | grep 'Configuration File'

My results:
    Configuration File (php.ini) Path => /opt/local/etc/php5
    Loaded Configuration File => /opt/local/etc/php5/php.ini
    
That will tell us which php you are using, but it may also be helpful to see
    $/opt/local/bin/php -i | grep 'Configuration File'
    $/usr/bin/php -i | grep 'Configuration File'

>> I have a feeling you're using a different PHP on the command line than
>> you're using in your web server.
> 
> I do too..

This would be controlled by the launchd item that is starting it, assuming you do not start Apache by hand.

What does:

    $sudo ps aux | grep -i http

return for you when Apache is running?

Also, please run:

    $sudo launchctl list | grep -i apache

Hopefully you get back something like:

    org.macports.apache2

You really need to make sure that the Apple Apache is not running, which is largely controlled in the System Preference Pane.  It is not to say you can not run them at the same time, but you do need to understand how to do so, and do so in a way that ports are not conflicting.  You very well could be trying to run both, and one is taking priority since they are both trying to grab port 80, and I guess Apple's is winning.

I honestly do not know why anyone would want to, aside from the legacy app and "it ain't broke, don't fix it" scenario. You are on a MacBook, telling me this is probably a development machine and you can be pretty aggressive about the edits you make.

>> Which Apache web server are you using -- Apple or MacPorts?
> 
> Again I do not know how to check that..

See above.

You attached a php.ini file, I did not get a chance to look at it.  The thing you need to take away here is that you can edit a php.ini file until your fingers bleed, and if you are not running the correct php and apache, then those changes are not going to ever make a difference.

Looking over your older threads here, it looks like you have MySql running, and you are also using the MacPorts version, as denoted by the "5" in the mysql5 command you showed. 

Are you running Mac OS X Server by any chance?

I think with the output to the commands above, someone here can guide you down the right path.  Right now, it is hard to say what is going on.  Personally, I would move your sites from /Library/WebServer/Documents once you get this up and working, and put them at /www or /home/www or something like that; somewhere where 1) Apple is more unlikely to mess with it, and 2) Apple is not aware it is there, so you know Apple's Apache will never locate it.

-- 
Scott * If you contact me off list replace talklists@ with scott@ * 



More information about the macports-users mailing list