Okay before we start I would like to mention that if you screw on any of these commands php will not work. If you wish to get to the document root of apache and use it as real webserver on the net the root of it is located at /library/webserver/documents and the CGI-BIN is located at library/webserver/cgi-executables. I do hope that this HowTo on PHP and MySQL helps you guys learn the terminal and its commands a bit better if you are new to MacOS X. As always please ask any questions you may have. My sources for info will be at the bottom of this HowTo.
PHP PART OF THE HOWTO:
Step 1) Start the Terminal Application.
Step 2) Type "curl -O http://www2.entropy.ch/download/libphp4.so.gz", wait for download to finish
Step 3) Type "gunzip libphp4.so.gz"
Step 4) Type "sudo mv libphp4.so /usr/libexec/httpd/"
Step 5) Type "cd /etc/httpd"
Step 6) Type "sudo apxs -e -a -n php4 libexec/httpd/libphp4.so"
Step 7) Type "sudo perl -p -i.bak -e 's%#(AddType \S+-php[ -])%$1%i' httpd.conf"
Step 8) Type "sudo apachectl graceful" to restart the web server
MYSQL PART OF THE HOWTO:
Step 1) Download and install the package http://www.machowto.com/mysql-3.32.47.pkg.tar
Step 2) Create a new user in the "Users" System Prefs pane:
1. Name: "MySQL User"
2. Short Name: "mysql"
3. Password: whatever you want
Step 3) Open a terminal window and type in the following commands (without the double quotes):
Step 4) type "cd /usr/local/mysql"
Step 5) type "sudo ./scripts/mysql_install_db", enter administrator password when asked
Step 6) type "sudo chown -R mysql /usr/local/mysql/*"
Step 7) type "sudo ./bin/safe_mysqld --user=mysql &"
Step 8) Use it with "mysql test"
Now you should have a perfect web hosting machine that runs PHP and has MySQL on it. It should also run any industry stand scripts such as a forum or a website. Credits are below.
I would like to credit http://www.entropy.ch for most of the infomation used and thanks to jadey for the links.
`Dave
PHP PART OF THE HOWTO:
Step 1) Start the Terminal Application.
Step 2) Type "curl -O http://www2.entropy.ch/download/libphp4.so.gz", wait for download to finish
Step 3) Type "gunzip libphp4.so.gz"
Step 4) Type "sudo mv libphp4.so /usr/libexec/httpd/"
Step 5) Type "cd /etc/httpd"
Step 6) Type "sudo apxs -e -a -n php4 libexec/httpd/libphp4.so"
Step 7) Type "sudo perl -p -i.bak -e 's%#(AddType \S+-php[ -])%$1%i' httpd.conf"
Step 8) Type "sudo apachectl graceful" to restart the web server
MYSQL PART OF THE HOWTO:
Step 1) Download and install the package http://www.machowto.com/mysql-3.32.47.pkg.tar
Step 2) Create a new user in the "Users" System Prefs pane:
1. Name: "MySQL User"
2. Short Name: "mysql"
3. Password: whatever you want
Step 3) Open a terminal window and type in the following commands (without the double quotes):
Step 4) type "cd /usr/local/mysql"
Step 5) type "sudo ./scripts/mysql_install_db", enter administrator password when asked
Step 6) type "sudo chown -R mysql /usr/local/mysql/*"
Step 7) type "sudo ./bin/safe_mysqld --user=mysql &"
Step 8) Use it with "mysql test"
Now you should have a perfect web hosting machine that runs PHP and has MySQL on it. It should also run any industry stand scripts such as a forum or a website. Credits are below.
I would like to credit http://www.entropy.ch for most of the infomation used and thanks to jadey for the links.
`Dave