![]() |
Can't view localhost after attempts to configure php & mysql
I am desperately trying to get my mbp 10.5.6 set up with php, mysql, and phpMyadmin for local php development.
I have tried tons of tutorials and even macports, but none have worked to get these programs functional and/or communicating with each other. I have edited my php.ini, and httpd.conf files. I've tried setting up a virtual host, which worked in my Sites folder, but not in Webserver/Documents. I've created and deleted a my.cnf file. After all this, none of these programs are functional and now I can't even view my localhost. Apache2 is running and http://localhost/manual takes me to the manual, but http://localhost, 127.0.0.1, etc... displays "Forbidden You don't have permission to access / on this server." I need this machine to be operational, but right now would even settle for getting all of the settings back to default, which I have no idea how to do. Can anyone help? |
Quote:
If you don't have backups, you can always do an "archive & install" from the Install DVD. |
Quote:
|
Guys, I really appreciate the help. I did not create backups of those files (lesson learned) before altering them so I will use the disc to get it back to default. Thank you for that tip.
I'll jump on that first thing tomorrow and we'll go from there. |
Getting PHP running is very easy - edit /etc/apache2/httpd.conf, search for 'php' and remove the comment mark at the beginning of the line.
For mySQL, go to their website and download the Mac installer. That's it. Really. VHosts works fine out of the box - create your config files with full paths to the DocumentRoot, and check things with `apachectl configtest` from the command line. |
Quote:
|
Quote:
|
Yep. Regular OSX comes with Apache, PHP, ruby, python, java but no mySQL.
|
Quote:
I'm sure that what appear to be simple procedures have worked successfully for others, but I just haven't had such luck. Would anyone mind providing a full step-by-step process for not only installing these programs, but also getting them configured to communicate with each other and phpMyAdmin? I performed the archive and install so I am now back at square one. btw: an IT guy told me over the weekend that this is a common hiccup with mysql 5 and that I should fall back to mysql 4 bc the fix would involve far more time/money than it's worth. Any thoughts? |
I use MySQL 4 without any problems (thought this isn't a big production server, but just databases for my classes and research, so...). to get php and mysql running, read the following: here and here. they both use terminal for text editing - yuck! -but otherwise are excellent guides. TextWrangler worked much better for me for editing the system files (just use the 'Open Hidden... feature under the File menu).
the only problem you might run into is some weirdness with where mysql expects it's unix socket to live - this is explained on the Remy Sharp page, if you run into it. |
Quote:
|
Ok, I removed the # from the LoadModule php line in httpd.conf. Localhost shows the apache confirmation and localhost/test.php shows the php5 page. Now for mysql and phpmyadmin. Where do all the php.ini edits come into play? Is that strictly for mysql configuration?
|
Since you're doing this for local development and you're having problems, maybe you'd be better off with MAMP. It comes with GD installed, phpmyadmin, and even a widget to start the servers!
|
you shouldn't have to play with the php.ini anymore, not to set up MySQL anyway. just download the version that you want and install it. MySQL runs as its own separate server, and PHP simply queries it (which it's already configured to do). the only tricky thing with mysql is securing it - assuming you don't want it left open for the internet universe to access - but it comes with a 'secure mysql' script that handles most of that for you.
if this is really just for local development, what you'll probably want to do next is set up a virtual host with restricted access, but we can discuss that later. and I disagree (mildly) with cwt - while MAMP is probably a great package, I always prefer to do things like this myself unless I have a reason not to. mostly because it's harder to figure out what went wrong when you're using someone else's prefab construction. but maybe that's just me. :D |
Well, the nice thing about MAMP is that it's pretty much good to go once you've downloaded it. Everything is self-contained, so it doesn't interfere with your current setup unless you try to run both simultaneously, and then it's just a matter of one receiving the requests and the other not.
There is a pro version, but I don't know if I'd use it on a production server for basically the same reasons that tw doesn't like it. It's better to know where everything is on a machine that needs to stay up. Plus, I think it's easier to upgrade the built-in system. |
This purpose of this machine is general web design, but I want the ability to locally test php without having to first upload to host. I have looked into MAMP and know that many are pleased with it, but in agreement with tw, I would really prefer to have each of these components installed the good old fashioned way without a 3rd party managing them.
|
Okay! I bought a book that walked me through getting most everything set up with the exception of one problem:
I set up phpMyAdmin 3.2 but the log in page gives me this error: "Cannot load mcrypt extension. Please check your PHP configuration." Does anybody know how to resolve this? The sourceforge site listed these dl's, but I don't know if they are the solution and, if so, what to do with them. mcrypt-2.6.8.tar.gz and libmcrypt-2.5.8.tar.gz I'm so close to getting this resolved. Please help! |
Additionally, when I try to login to phpMyAdmin, I get: #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
Could this have to do with the location of the mysql.sock file in /tmp versus var/mysql? I have not made any changes to this or created a my.conf file yet. I am hesitant to mess with this prior to your feedback. I don't want to botch things like my last attempt. Please advise. |
the mcrypt extension thing you can ignore; I think you need to recompile PHP to get it to work (the standard Apple implementation doesn't include it, and I haven't yet found a pre-compiled extension that works with Macs). I'll look at the sourceforge links, though.
as for the other, it might be something to do with the socket file, but I'd check first to see that apache and php are up and running, and that you don't have http.conf configured to deny access to to the MySQL server. by default it shouldn't, so if all you did was enable php that won't be it. You might also have a permissions issue. did you install phpMyAdmin in the document root (/Library/WebServer/Documents) or in your user Sites folder? and are you running it from an administrative account or a normal user account. |
Ok. Glad to hear I can ignore the mcrypt message. Apache and php are both up and running. The only change made to http.conf was uncommenting LoadModule php5. phpMyAdmin is in Library/Webserver/Documents and I am running my administrative account.
Here's exactly what I've done so far: edited etc/apache2/httpd.conf by removing # from LoadModule php5 line. started web sharing. copied php.ini.default to php.ini with sudo cp command. edited php.ini error_reporting from E_ALL & ~E_NOTICE to E_ALL performed the following commands in case any remnants of mysql were still present. sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo rm -rf /Library/StartupItems/MySQLCOM sudo rm -rf /Library/PreferencePanes/My* edit /etc/hostconfig and remove the line MYSQLCOM=-YES- sudo rm -rf /Library/Receipts/mysql* sudo rm -rf /Library/Receipts/MySQL* installed mysql 5.1.35 pkg, startup item and pref pane. edited .profile by adding export PATH=/usr/local/mysql/bin:$PATH logged into mysql with mysql -u root and secured the installation by setting a pw, deleting user ' '; and flushing privileges dl phpMyadmin 3.2 created webserver/documents/phpmyadmin/config.inc.php and added <?php $i = 1; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['password'] = 'mypassword'; ?> That is it. See anything I missed? |
did you start the mysql server? check the preference pane to see if it's turned on. me, I have a launchd item that starts the server automatically at login - looks like this (not sure where I picked this up, and you may have to adjust the path, but it works. put it in /Library/LaunchDaemons):
Code:
<?xml version="1.0" encoding="UTF-8"?> |
Sorry to keep posting, but I figure that more information will only help determine the problem. MySQL showed that it was running in the preference pane as soon as I installed it and allowed me to make the changes I mentioned above. I was unable to stop mysql from the pref pane, though. I tried shutting it down with sudo /usr/local/mysql/support-files/mysql.server stop and got ERROR! Manager of pid-file quit without updating file. I restarted the machine and am unable to start mysql with either the pref pane or terminal. Pref pane asks for my pw, but nothing else happens. Terminal gives same pid-file error above.
|
Your post reminded me that I'd set up a launchd item the last time I tried to set up mysql. It's a little different, but looks to be similar. When I looked for it, I noticed that I've got two mysql folders in usr/local. One is usr/local/mysql and the other is usr/local/mysql-5.1.35-osx10.5-x86, which is the version I installed this morning. Both folders have all the same subfolders. Could this be an issue?
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>Label</key> <string>com.mysql.mysqld</string> <key>Program</key> <string>/usr/local/mysql/bin/mysqld_safe</string> <key>RunAtLoad</key> <true/> </dict> </plist> |
I have a folder called "mysql-standard-4.1.22-apple-darwin8.6.0-powerpc" and a symlink called mysql that points to that folder. if you have two versions installed, I'd suggest you delete the folder called mysql and replace it with a symlink to the recently installed version, otherwise your system will be trying to start up the wrong version.
|
Ok, I see what you're saying. It does look like the same situation. The Mysql folder is just an alias. Does it look like I missed any configuration steps because mySQL will not start up at all.
|
| All times are GMT -5. The time now is 07:09 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.