Opened 14 years ago
Closed 7 years ago
#24956 closed defect (wontfix)
Having trouble using mysql5 and php5
Reported by: | samii@… | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | wiki | Version: | |
Keywords: | Cc: | ryandesign (Ryan Carsten Schmidt), pixilla (Bradley Giesbrecht) | |
Port: | php5 |
Description (last modified by ryandesign (Ryan Carsten Schmidt))
Hi:
I have started the process of installing MAMP as per the instructions on the MacPorts wiki howto for MAMP on howto/MAMP
I had no problems through the beginning of Step 3: Install MySQL. The port install worked seamlessly.
However, setting up the database was very silent (no feedback what so ever).
The autostart seems to work, and grep filtering for mysql processes seems to indicate mysql is running no problem.
But when I try to set the root password, I get the following error.
mysqladmin5: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)' Check that mysqld is running and that the socket: '/opt/local/var/run/mysql5/mysqld.sock' exists!
Likewise, when I try to log into the server, it says:
Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)
I am running Mac OS X 10.6.3
2.4 GHz Intel Core 2 Duo
3 GB Ram
Not sure how to proceed.
Attachments (4)
Change History (23)
comment:1 Changed 14 years ago by samii@…
Cc: | samii@… added |
---|
comment:2 Changed 14 years ago by samii@…
OK, well, I resolved that problem. I had to kill the mysql processes that were active and start them up again.
Now, I tried installing php5 following the same instructions. No errors reported, but when I try to load phpinfo.php, it doesn't work. It just loads the document as a text file in the browser window.
comment:3 Changed 14 years ago by jmroot (Joshua Root)
Cc: | samii@… removed |
---|---|
Component: | ports → wiki |
Port: | php5 added; mysql removed |
Priority: | High → Normal |
Version: | 1.8.2 |
comment:4 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ryandesign@… added |
---|---|
Description: | modified (diff) |
Then that's a separate issue.
Have you added this line to your httpd.conf and restarted Apache?
Include conf/extra/mod_php.conf
comment:6 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)
Summary: | Having trouble installing mysql → Having trouble using mysql5 and php5 |
---|
And you've run
cd /opt/local/apache2/modules sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
and verified that
LoadModule php5_module modules/libphp5.so
appears in the httpd.conf up where the other LoadModule directives are?
comment:8 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)
Then this doesn't make sense. Can you attach your httpd.conf and phpinfo.php?
Changed 14 years ago by samii@…
Attachment: | phpinfo.php added |
---|
comment:9 Changed 14 years ago by samii@…
FYI, when I ran the above command, I received the following message, which to me indicates that PHO is now active within apache2
$ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so Password: [activating module `php5' in /opt/local/apache2/conf/httpd.conf]
comment:10 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)
The httpd.conf you attached looks a lot like /etc/apache2/httpd.conf. That's the configuration file for Apple's Apache server included with Mac OS X. When using the MacPorts php5 port, you're going to be using the MacPorts apache2 provided in the apache2 port, whose configuration file is at /opt/local/apache2/conf/httpd.conf. That's the file you'll be editing.
comment:11 Changed 14 years ago by samii@…
Should I consider completely uninstalling MacPorts and all ports that are installed and starting fresh?
If so, what is the best installation strategy to employ?
comment:12 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)
I don't know why that would help, but I also don't know what else to suggest. Well, I suggest you write to the macports-users mailing list; that will be read by a lot more people than comments in a ticket and maybe someone else has suggestions.
If you want to uninstall MacPorts, instructions are in the Guide.
comment:13 Changed 14 years ago by samii@…
Well, I've uninstalled everything and right now, I am in the process of reinstalling. mysql5-server is installing now.
I am following the howto here on MacPorts. Just to be sure, because I believe that my errors result from my last attempted install.
Once mysql5-server is installed, I need to set up the main database and then start mysql5-server. There are two ways of setting up the main database as per the howto. Which would you recommend?
Likewise, I believe I had problems with setting the password last time. What output should I expect when I set up the password, and what should be a red flag that something is broken?
Also, should I run the optional security configuration?
comment:14 follow-ups: 16 17 Changed 14 years ago by samii@…
OK, went through all the steps as defined in the howto.
Now, instead of the phpinfo.php file showing up as text echoed on screen, it downloads as a downloadable file.
What do I need to edit or change?
I am attaching the new phpinfo.php and newly generated httpd.conf files here.
Changed 14 years ago by samii@…
Attachment: | httpd.2.conf added |
---|
New version generated after reinstall
Changed 14 years ago by samii@…
Attachment: | phpinfo.2.php added |
---|
New phpinfo.php file created after new install
comment:15 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)
The only difference between the two httpd.conf files you posted is the DirectoryIndex line which wouldn't account for this difference in behavior you observed.
Please write to the macports-users mailing list for help. There are many people there using PHP and MySQL successfully in MacPorts; maybe one of them can walk through the setup with you.
comment:16 Changed 14 years ago by info@…
Replying to samii@…:
Now, instead of the phpinfo.php file showing up as text echoed on screen, it downloads as a downloadable file.
Here's a shot in the (not so) dark.
Sounds like apache isn't associating the '.php' extension with the php engine.
I see your httpd.conf has the include line:
Include conf/extra/mod_php.conf
Make sure that this file exists (full path: /opt/local/apache2/conf/extra/mod_php.conf), that it's readable by whatever user (on your local box, you can make it readable by everyone), and that it has these lines:
<IfModule mod_php5.c> AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps </IfModule>
(as always, restart apache after any changes)
If this doesn't fix it, turn on apache error logging and check for errors.
comment:17 Changed 14 years ago by info@…
Replying to samii@…:
You might also try a full path to the mod_php.conf file. That's what's working for me, though I didn't test with a relative path.
comment:18 Changed 10 years ago by jmroot (Joshua Root)
Cc: | pixilla@… added |
---|
Should this still be open? Does it even describe a bug?
comment:19 Changed 7 years ago by raimue (Rainer Müller)
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I see no further action that could be taken on this report. Maybe the instructions on howto/MAMP need an update, but it is not entirely clear if this still applies to the current version.
Cc Me!