Since my OS X re-install a few weeks ago, I haven’t found the time to install my local server. I kept delaying it because I had a feeling it was going to be a chore to configure properly.
Well, I just found out about a cool new project called MAMP which will easily install Apache, MySQL, and PHP. No muss, no fuss. When you don’t need it anymore, just throw the folder into the trash.
I decided to give it a shot, since it looked really easy to install and un-install. I normally run as a standard user, so I figured I should log in as administrator for this particular install; I launched the .dmg file, then dragged the MAMP folder into my Applications folder. I switched back to standard user, and I have no idea why, but Apache nor MySQL would not start. I tried logging in as administrator again, and even changing my standard user to an admin user. It didn’t work.
I tried searching on the Help Forums on the MAMP site, and found plenty of questions, but rarely any answers. (I really shouldn’t complain about the lack of support, since it is freeware, but be aware, you are probably going to be on your own if you need additional help.
Anyway, I decided to start from scratch, so I dragged the MAMP folder into the trash. There was a slight problem emptying the trash; an error message popped up stating MySQL was still running (???) but eventually after a restart, I could remove all of my initial installation of MAMP.
For my second try, I installed as a standard user, and after I dragged the folder into Applications, I launched MAMP. To my delight, it worked! Success!
The start page launched in Firefox, and it is very easy to access PHPMyAdmin and SQLiteManager this way. My launch page was http://localhost:8888/MAMP/index.php?language=English.
Next, I needed to change the location of my root web files. By default, MAMP requires all files to be saved in the htdocs folder found in the MAMP application folder. To change the configuration, launch the MAMP.app, and choose Preferences>Apache. I changed the document root to my main web folder. Yay! It works!
When accessing web files in your browser, make sure to point to the address http://localhost:8888/ and this should display the root of your web documents.
So far it appears to be working very well.
Related Links:
* How to secure MAMP
* Apple.com
* Fix WP permalinks in MAMP
* Textpattern.net Using MAMP
Thanks to Miraz at MacTips.info for the heads up on this.
After updating to Mac OS X 10.4.4, some are finding their local databases are broken. I checked my MySQL database and as suspected, it is not working.
After some reading this morning, I think I finally understand what happened. After the update, PHP cannot find MySQL. An entry at Relative Sanity explained it very well.
What I did on my system:
launch terminal, and type
sudo cp /etc/php.ini.default /etc/php.ini
the sudo command allows you temporary access as root user. You will need to type in your password. This command will create a copy of the php.ini.default file and name it php.ini (IMPORTANT: if you already have a php.ini file, there is no need to replace it with the default file, so skip this step. I followed this step, and now, I am hoping I didn’t already have a php.ini file with some edits. Oh well, I will soon find out.)
Open the php.ini file in text editor. I use pico/nano in Terminal.
sudo pico /etc/php.ini
you can also type
sudo nano /etc/php.ini
Again, this will access the file as root user (sudo command) – you might need to type password again.
Once the file is open in the text editor, search by clicking ctrl+W (Whereis) and type “mysql.default_socket” (no quotes.) You should find this line of code:
; Default socket name for local MySQL connects. If empty, uses the built-in ; MySQL defaults. mysql.default_socket =
Add this bit of code /tmp/mysql.sock
so PHP knows where to find MySQL
; Default socket name for local MySQL connects. If empty, uses the built-in ; MySQL defaults. mysql.default_socket = /tmp/mysql.sock
Click ctrl+X (to exit and save), Type “y” to save, and enter to name the file.
Restart Apache. The command I use for this is
sudo /usr/sbin/apachectl restart
TIP: I use Mac Stickies to keep frequently used terminal commands and other notes. I keep Stickies in my Dock, and when needed I launch the application.
It looks like MySQL is working now. Hopefully there won’t be any other problems later.
More linked details can be found at Mac OS X Hints
My problems started last week when I wanted to install phpMyAdmin locally on Mac OS X Tiger. It was not allowing me to install and displayed an error that the MySQL version was out of date.
I thought the installation of MySQL 4.1 went smoothly, but I found out later (from several sources,) that MySQL version 4.1 was not the best version to install and that a prior version of 4.0 will be more compatible with certain software. This was the reason why I was having a problem installing phpMyAdmin.
Here is a web page I found on the subject: phpMyAdmin Broken in Tiger
There were no databases to backup, so I proceeded to remove the directories for MySQL.
I tried to install the 4.0 version of MySQL but the installer package displayed an error message “You cannot continue. There is nothing to install” and would not let me install the package.
I re-installed MySQL version 4.1, and that installer caused no errors. To remove this installation, I used the cleanup script from Entropy.ch. I assumed it worked properly, so I tried installing the 4.0 package, but the error message popped up again.
I ran the cleanup script again, and the list of files displayed as “file not found.” Let’s try the 4.0 install package one more time. It worked! It worked! Finally!
So, now that MySQL is installed properly (I hope), I can move forward to the next steps to configuration. Here are some helpful sites which explain in detail how to configure MySQL as well as Apache and PHP for the Mac:
* creativebits.org-Test Drive Dynamic Websites Locally
* Mac Zealots – Installing WordPress on Tiger
* Apache Web Serving with OS X
* Installing a Wiki on your iBook
* Security and MySQL
* Removing MySQL and Starting Over
Now I am off to configure MySQL and install some tasty programs locally!
Just found out how easy it is to save .htaccess files on a local (Windows) Apache environment. Yippee!
I couldn’t be without the Apache web server on my Windows system for offline testing. But keeping all web files saved in the “htdocs” folder in Apache can be annoying. This is where defining an alias in the Apache httpd file will allow you to save web files anywhere on your system.
Open the httpd.conf for configuring Apache.
Read the Rest of the Article
Tonight I worked on installing perl on my Apache server on my Win XP system. I am so excited to run a few blogging scripts on my own hard drive to experiment and test templates, etc.
At first I was very confused and I didn’t know what to do. Looking at the ActivePerl web site, it looked pretty intimidating and I didn’t know if I was ready for the challenge. But after googling for "installing perl on apache", I printed out two good tutorials and combined the information from both to make it work for me:
* Installing & Configuring CGI Tutorial
* Installing Perl Tutorial
So, here we go!!
* Download the latest version of Activeperl (I downloaded 5.8.3 build 809 MSI) and install.
* I changed the default install to c:\usr\ so it matched to Hosting Matters (my host) path to perl.
* I kept the other install options at the default. After install was completed, I rebooted Windows.
* Opening the conf\httpd.conf file (for Apache) I edited line #335 and added the text ExecCGI so it reads "Options Indexes FollowSymLinks ExecCGI MultiViews Includes" (It is best to read both tutorials for more details on your config file, as the text might look slightly different in your file.)
* I uncommented the AddHandler cgi-script .cgi and also added AddHandler cgi-script .pl right under it. (This allows scripts to run outside of the cgi-bin folder, see the tutorials for more details.)
* I left ScriptAlias /cgi-bin/ as is, and did not comment out the code.
* I already had .shtml includes enabled, so there were no edits needed for this (see the tutorial for more details, server side includes are very important to web design.)
* After edits were made, I saved the file, then restarted Apache.
* Since I installed perl to my c: drive and Apache is installed in my d: drive, I can’t use the default #!/usr/bin/perl as the shebang notation (the top line in cgi files) because perl can’t be found in the same partition. For my script files, I must change the top line to #!c:/usr/bin/perl.exe or #!c:/usr/bin/perl to give the direct path to where perl is installed. If Perl is installed in the same partition as Apache, then it is much easier. The best thing is to try the default path in the testing hello.cgi script and if it doesn’t work, then specify the path directly.
Yay, and now I am done and hopefully I can install some neat scripts to test on my own system! Next stop my laptop!