Jump to content

[HowTo] Web Server Setup Tiger 10.4.3 (8f1111a)


15 posts in this topic

Recommended Posts

In this article, I will cover how to set up the server components. I do not address security in this How-To, so it is extremely important that you learn about it if you plan on running your site live.


At the time of writing, my configuration is Mac OS X 10.4.3 8f1111a, Apache version 1.3.33, PHP version 4.3.11, MySQL database server version 5.0.18, phpMyAdmin 2.7.0-pl2.


Applications to download:


TextWrangler 2 (Optional): http://www.barebones.com/products/textwrangler/index.shtml


A text editor for a wide variety of tasks from cleaning up data, to editing configuration files on your Mac or server, to writing HTML or coding.


MySQL 5.0 Community Edition Standard (Preferred): Mac OS X 10.4 (x86)


Download: http://dev.mysql.com/downloads/mysql/5.0.html

Mirror: http://dev.mysql.com/get/Downloads/MySQL-5...6.dmg/from/pick




Apache Web Server Configuration


By default, Apache and PHP is already installed when you install Mac OS X 10.4.3 (Tiger). Apache and PHP is already configured from the start. However, if you want to enable PHP, we will have to make minor configuration changes to the httpd.conf file. To enable the PHP module, edit as follows:


1. Launch Terminal from /Applications/Utilities.


2. Edit the httpd.conf by pasting this command in terminal:


sudo pico /etc/httpd/httpd.conf


3. When prompted for a password, enter your administrator account password.

4. Uncomment the following lines (remove the "#"):



#LoadModule php4_module libexec/httpd/libphp4.so
#AddModule mod_php4.c



LoadModule php4_module libexec/httpd/libphp4.so
AddModule mod_php4.c


5. Add the following lines above: AddType application/x-tar .tgz:



AddType application/x-tar .tgz



AddType application/x-httpd-php .php 
AddType application/x-httpd-php-source .phps
AddType application/x-tar .tgz


Note: All the commands for the pico editor display on the screen and you can start any commands with the Control key. Use the arrow keys to move around. Pico is a text editor, mostly for UNIX users to use at the UNIX command line.


6. Add a new index page for PHP (index.php) so that the web server will recognize it as the first page to load:



<IfModule mod_dir.c> 
DirectoryIndex index.html index.htm




<IfModule mod_dir.c> 
DirectoryIndex index.html index.php index.htm


7. Save the httpd.conf file by pressing (control + x keys). When the screen asks "Save Modified buffer?", press "Y". When prompted for "File Name to write : httpd.conf", press Return once to accept it. This will return you to the UNIX shell prompt.



Stop and Start Apache


In System Preferences, as follows:


1. Launch System Preferences.

2. Select Sharing.

3. To stop the Apache web service, uncheck the "Personal Web Sharing" checkbox or click the Stop button.

4. Click the Start button to start "Personal Web Sharing." This will turn on the Apache web service.


Testing the Apache Web Server with PHP


I use TextWrangler, a text editor to create a PHP file to test your Apache configuration. This determines if you successfully enabled the PHP application server module. To test the PHP module, follow these steps:



1. Launch TextWrangler

2. Copy and paste the following PHP code into the new document:




3. Choose File > Save As... Save the file as phpinfo.php into the /Users/Username/Sites directory.

4. To test this file, fire up Safari and browse at the following URL: http://localhost/~UserName/phpinfo.php where ~UserName is the name of your account. If you have configured everything correctly, the following appears:






Installing MySQL Database


You can download the precompiled MySQL Universal Binary from:




Once you've downloaded the MySQL installer, double click the MySQL installer package (mysql-standard-5.0.18-osx10.4-i686.dmg) and follow the instructions. Please don't forget to read the ReadMe.txt contained in the installer dmg. By default, the MySQL installation installs in the /usr/local folder.


1. Double click the MySQL Installer (mysql-standard-5.0.18-osx10.4-i686.pkg) to install the MySQL database.

2. Double click the MySQL.prefPane

4. Double click the MySQLStartupItem.pkg if you want MySQL to start every time you boot into Tiger (Optional).

5. You need to set up the password for the root account (this root account is the super user of MySQL database), enter:


/usr/local/mysql/bin/mysqladmin -u root password 'change_this_to_your_own_password'


8. To test if you can log in using the root account, enter:


/usr/local/mysql/bin/mysql -uroot -p mysql


When prompted for a password, enter the newly created password. The mysql> database prompt appears. To log out of mysql, just type: quit


Note: If you encounter any problems, repeat steps 1 through 8 above. You must first completely remove the MySQL installation by running:


sudo /usr/bin/rm -rf /usr/local/mysql/




Install phpMyAdmin


1. Download the latest stable version from: http://www.phpmyadmin.net/home_page/downloads.php

2. Un-archive the file and copy the folder phpMyAdmin into the /Users/Username/Sites directory. Edit the config.default.php file contained in the phpMyAdmin directory with TextWrangler and change the following:



$cfg['Servers'][$i]['user']		  = '';
$cfg['Servers'][$i]['password']	  = '';



$cfg['Servers'][$i]['user']		  = 'root';
$cfg['Servers'][$i]['password']	  = 'change_this_to_your_own_password';


3. Fire up Safari once more and browse to the following, where ~UserName is the name of your account.:




4. If it asks you to enter your username and password, enter the the one you used for Step 2 of this section.


You might get this error message: "Client does not support authentication protocol requested by server; consider upgrading MySQL client"


Why?: The reason you get the error message is that MySQL 5.0 uses an authentication protocal based on a new password hashing algorithm that is not apparently supportet by your current php (or apache?). Command old_password assigns password with old algorithm.


In terminal enter the following:


/usr/local/mysql/bin/mysql -uroot -p mysql


mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost;


Command to set password in old format:


mysql> SET PASSWORD FOR root@localhost = OLD_PASSWORD(change_to_your_own_password');


5. Type: quit

6. We now need to go back to System Preferences and restart MySQL service.

7. Browse to: http://localhost/~UserName/phpMyadmin/ and you should be able to perform database tasks in phpMyAdmin.


If there are mistakes or you know a way to make it easier/better, I am always open to suggestions. If you know a way to install the current Apache, PHP, and MySQL builds, please do start a new thread and let us know. As of now, this is the only way I know to install the application servers without breaking the current Tiger installation.


Enjoy your new server!










Link to comment
Share on other sites

  • 1 month later...

OK, I'm stuck.


1) Activate PHP - check. working great

2) Install MySQL - check. can access via shell with "/usr/local/mysql/bin/mysql -uroot -p mysql"

3) Install PHPmyadmin - I install this, then when I go to it in my browser I get the following:



MySQL said:#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)


Any ideas as to why I can't access PHPmyadmin through the browser?

Link to comment
Share on other sites

aha! OSX10.4.4 (and 10.4.5) breaks PHPmyAdmin, which is why it doesn't work. here is how you get it running :


1) start up a shell

2) cd to /private/etc

3) type sudo pico php.ini.default

4) find the line that says : mysql.default_socket =

5) change this to : mysql.default_socket = "/tmp/mysql.sock"

6) ctrl-x to save

7) you now need to rename the php.ini.default file. type : sudo cp php.ini.default php.ini

8) do a quick ls to make sure php.ini is in there

9) restart apache with : apachectl graceful



now, if you did all that correctly, fire up your browser and go to http://localhost/yourusername/phpmyadmin and it should pop up.


(all credit to Nick's Blog for that fix)

Link to comment
Share on other sites

This How-To got really old since the Universal PHP got released. The installation and configuration is much easier now thanks to that :angel:. In any case, i'm glad you got it working xiberia! Now, do you want to start mirroring maxxuss' site? :P


edit: if you don't want to configure phpMyAdmin, google up "CocoaMySQL-SBG" at MacUpdate. I think you'll find it usefull.

Link to comment
Share on other sites

  • 2 weeks later...

Unless they've compiled PHP, Apache, MySQL as universal binary, it's not even an option to install these out-of-the-box-wanna-be servers on a Mac x86 OS.


And it's XAMPP MacOS X 0.5. Please don't mistaken this for OS X 10.5.

Link to comment
Share on other sites

Oops, I did make that mistake, seeing 0.5 and thinking I saw 10.5, and then confusing that with 10.4.5. Not an option yet, then. Incidently, I put XAMPP on Solaris 10 recently, and then put MediaWiki on top of it, and I've been real happy with it so far.

Link to comment
Share on other sites

thing is with those all-in-one solutions like MPP, they're not made with security in mind - they're made to test out your websites offline. setting up your OSX server with Domino's instructions means its patched and fairly secure. Good enough for lan use, anyhow.

Link to comment
Share on other sites

Those all-in-one can be of some value. For exampe say you don't want to change the system files because you ar running OS X on a PC. It would cause some trouble for you if Apple upgrades some parts of php and apache. Installing it means never touching any system files at all. SO it all depends on what and how you will using it. The greatest thing is when the all-in-one become universal binary, you have an option.

Link to comment
Share on other sites

I set up my server with your instructions. in the 10.4.5 security updates were lots of changes to php etc but it didn't break it. of course, an update to 10.5 probably would break it, but you just follow the instructions again to reactive (unless they're including Apache 2 and PHP5 in 10.5, in which case new instructions are needed) :)

Link to comment
Share on other sites

I set up my server with your instructions. in the 10.4.5 security updates were lots of changes to php etc but it didn't break it. of course, an update to 10.5 probably would break it, but you just follow the instructions again to reactive (unless they're including Apache 2 and PHP5 in 10.5, in which case new instructions are needed) :D

LOL. Thanks for letting me know. I sure didn'twant the headaches. That's why I haven't updated yet :)

Link to comment
Share on other sites

  • 5 months later...

  • Create New...