ResExcellence | iTunes 5 GUI
image ResEx Logo
ResExcellence www : Powered by Google
Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets


Files are in Stuffit 5 or greater format.
Free download.

Tell us about a bad link.

Thank You!


Running 1 day
without a restart.

MySQL and PHP Installation Tutorial by Christopher Sample

Like many of you, I jumped right into 10.0.x hoping to join the ranks of the elite Unix and Linux users, developers and overall ‘extreme geeks’. One of the first things I wanted to do with 10.0.x was to install PHP and MySQL, as well as get Samba up and running (but that’s another tutorial!). I quickly sparked up the internet and began perusing the many sites and posts related to the installation of these magical beasts, only to find that no one agreed completely on the installation.

That worried me. I found that everyone had a piece of the puzzle, but no one had the whole package. I also found that several of the links to the PHP package I previously installed in 10.0.x were dead.

So, I gleaned as much information from as many sites as possible, as well as posts on many others, and found what I believed to be the best method for installing PHP and MySQL. Thanks to a package put together by Marc Lyanage, the MySQL install was a snap. For simplicity, I will be using his packages for the MySQL install.

PHP on the other hand was a bear. While Marc’s site was informative, I could never get PHP to install on 10.0.x or 10.1 with his instructions. Likewise the Stepwise site was of little assistance, nor was PHP’s own site.

Below are the culminations of many email conversations, posts from various sources, tutorials from other sites, developer sites and too many others to mention, but I have found the correct methods for installing PHP and MySQL on 10.0.x and 10.1.

Let’s get to it! We will be using MySQL version 3.23.43 for this build. I haven’t been able to successfully install 4.0 yet. It is still in the beta stage and therefore cold be unstable.

MySQL: PART 1

1. Download the following packages, provided by Marc Lyanage and save them to your desktop.

2. The files should unstuff upon completion of the download, if not then please unstuff them.

3. The resulting files will have icons that resemble a cardboard box with the top open. These are MacOS X packages. Please double-click on the files and follow the on-screen instructions throughout the remainder of the install.

4. When you are finished, continue to Part 2.

MySQL: PART 2

1. Once this is performed, you need to add a mysql user, though I got used to using my own user. You can do either, but I do recommend at some point you set up a mysql user. This will be done in the “Users” control panel in “System Preferences”.

Open the System Preferences by clicking on the “Apple”, go down to “System Preferences” and click.

Once the control panel opens, look at the bottom right of the panel. There you will see “Users”. Click on “Users” then “Add User”. There you will see two text boxes, the one on top is asking for your user’s long name, which will be “MySQL Database Server” and the one on the bottom is asking for the short name, which is “mysql”. Next click on the “Password” tab and type in a password for your new user.

Here is what mine looks like:

2. Next, open a terminal window and type “cd /usr/local/mysql- (This changes the working directory to the mysql directory)

3. Type “sudo./scripts/mysql_install_db”, enter administrator password when asked. – (This is the install command)

4. Type “sudo chown -R mysql /usr/local/mysql/*” – (This changes the ownership of all the files in the mysql database to being owned by the user ‘mysql’)

5. Type “sudo ./bin/safe_mysqld --user=mysql &” – (This is the command that starts MySQL under the user mysql)

When you type the command to start mysql, do not be alarmed if your cursor seems to be stuck. In other words, if you do not receive another prompt on the next line…. don’t worry.  Mine doesn’t either, but mysql works flawlessly. Just close that terminal, open another one, and type “mysql” at the prompt. You should go right into the mysql program.

6. At this time you may type “mysqltest” to test mysql. – (I have never received a statement from this command unless there is an error. The main error that you may receive is one stating that it can’t connect through the mysql.sock. If this occurs, then you do not have mysql installed correctly and I recommend setting up the user again, and double-checking the user in ‘Netinfo’ in the ‘Utilities’ folder in ‘Applications’. Then reinstalling mysql. More on this later.)

7. If you do not receive an error then congratulations. You have just installed mysql!!

Next, the one that we have all had trouble with….the dreaded PHP

We will be using PHP 4.0.6, which was the latest version at the time of this tutorial.

This one has more nuances associated with it and is not for the weak-hearted, but don’t worry, we will prevail! One of the first things I would like to point out is that the install for 10.0.x and the install for 10.1 are different. This article primarily focuses on 10.1, but for those of you still struggling with 10.0.x, I will provide the differences, of which there are only a couple in blue text.

If you go to Marc Liyanage's site, you will notice few instructions and no PHP package. Instead he directs you to the PHP site and the StepWise, as does the Apple Developer site. The problem is that both the Apple Dev site and Stepwise redirect you to the PHP site. This wouldn’t be so bad except that the ‘wget’ and ‘curl’ link commands on the StepWise site are dead links.

So, what do you do??

Download my PHP files. They are the ones that I used so I know they work.

PHP.sit for 10.0.X

PHP10.1.sit for 10.1

The reason for the difference in PHP files is that the 10.1 version requires a change in the ltconfig file. The 10.0.X version can run without the change.

Now that you have downloaded the PHP.sit file, we can get to work.

1. Double-click on the file. This will unstuff the folder and its contents.

2. Double-click on you hard drive. Click on ‘Home’ in the toolbar. This will take you to your ‘Home’ directory on the hard drive.  (I use this because it is easy for everyone to find)

3. Drag the PHP Folder to the ‘Home’ window and drop. – This will copy the folder to this window.

4. Open a terminal window.

5. I am comfortable using ‘root’ for installs, so I will be using this method. As long as you follow the on-screen instructions, you have nothing to fear from using ‘root’ access.  So type ‘su’ and hit enter and enter your root password when prompted.

6. I would walk you through the change of line 1469 in ltconfig, but I have already performed this change for you. For those interested in what it is, read this page.

7. Type, ‘cd /users/yourusername/php-4.0.6’ and hit enter. Where yourusername is the name of your normal user account.

8. In order to circumvent some new changes to 10.1, we must enter a new command. So now type ‘setenv CC 'cc -flat_namespace’’ and hit enter. 10.0.X user can ignore this step.

9. Now comes the configure command. Hit the enter key after each of the following lines:

./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/share/man \
--with-apxs \
--with-zlib \
--disable-pear \
--with-mysql=/usr/local/mysql < /dev/nul

The < /dev/null ending tag can also be ignored for 10.0.X users.

Once the last command is entered, it should go to town.  Once you receive a prompt again, follow the next set of instructions:

1. Type ‘make’ and hit enter.

2. Once that completes, type ‘make install’ and hit enter.

It’s all done except for the test…

1. Open an html editor, BBedit lite, Word, etc. (several are available for free from Apple’s OS X Download area), and create a new file.

2. Type in the following ‘<? phpinfo() ?>’.

3. Save the file as ‘test.php’ and save it to your sites folder. If you do not know where that is, it is in your ‘Home’ folder that we were in earlier.

4. Once the file is saved in the sites folder, then open explorer and type ‘127.0.0.1/~yourusername/test.php’ in the address bar.  Again, yourusername is the username you use. If in doubt, look at the users panel in System Preferences and use the short name.

If you received a page that resembles the pic below, then you are done. If you received an error at any time during the process, then you may need to go through the steps again, or email me with specific problems you are having.

At this time I would like to thank Marc Lyanage, for his endeavors in making the MySQL packages and for all his email assistance. I would also like to thank everyone who responded to my posts on various sites, including the Apple Discussion Board and MacFixIt, as well as many others. (The list is too extensive to place in its entirety) And lastly, thanks to those on the developer sites who were able to provide the last few pieces of the puzzle for the PHP install on 10.1.

Good luck!

ssample@massconfusion.com

Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

Maintained by the Staff of ResExcellence. This entire site ©1997-2005 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement.