I used MacPro with MAC OS X Server 10.4.7 (gcc 4.0) as our web server. The machined is shipped with Apache 1.3 and MySQL 4 installed. If you want to know how to use them, you may look at Apple's Web Hosting Help. However, I decided to install latest Apache2, PHP5 and MySQL5.
I downloaded and installed the latest MySQL Community Server 5 manually first for some reason. Then, I had to install Apache and PHP.
Before the installation, you'd better stop the running httpd and mysql server if they are there.
At first I tried to use FINK to accelerate this procedure. In FINK, PHP5 has no stable release yet. During the installation, there are some problems but can be solved as suggestions here. But when I tried to compile PHP5 to support the manually installed MySQL, I repeatedly get this this error:
apxs:Error: Activation failed for custom /sw/etc/apache2/apache2.conf file..
apxs:Error: At least one `LoadModule' directive already has to exist..
|
Finally, I unintalled Apache2 and PHP5 from FINK and decided to manually install them. The latest version httpd-2.2.4 and php-5.2.3. I found a good tutorial on MAMP installation and following their suggestions on installation if Apache 2 and PHP 5.
Everything looked OK except one strange problem: I cannot use mysql_connect() function to connect mysql, although I was able to connect the mysql server through Terminal by mysql -u root -p. I spent much time on searching the Internet and finally found that the bugs are in /etc/my.cnf. Notice /var/lib/mysql/mysql.sock in that file, although mysql_config showed /tmp/mysql.sock, which was the configuration that I chose during the installation. After correcting /var/lib/mysql/mysql.sock to /tmp/mysql.sock and restarting mysql server, the problem is solved. So remember to check if the output of
mysql_config --socket is the same as the socket variable in your /etc/my.cnf.
Now you should be able to access http://your_domain(localhost, or your IP address, or domain name). Write some test files to test if you can use PHP and MySQL.
To make the default web page directory as the Sites for every user, check if you have something like the following in your httpd.conf or other .conf files:
<IfModule userdir_module>
UserDir Sites
UserDir disabled root
<Directory /Users/*/Sites>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
</Directory>
</IfModule>
|
Restart Apache server. Now you should be able to access http://your_domain/~username. If access is denied, check if the following configuration is in your .conf files:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
|
If it is, adding '#' at the beginning of each line to comment it out. Remember to restart Apache server again.