|
#1
| |||
| |||
| [HOW-TO] - Setup PHP & MySQL 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
__________________ 12" PowerBook G4: 1.5Ghz, 768MB/RAM, 60GB HDD, Combo Drive, 64MB GeforceFX 2 Go, Airport Extreme + BT Quicksilver G4: 1.53Ghz G4, 1GB/RAM, 160GB HDD, SuperDrive, Radeon 9800 Pro (128MB), Airport Card, AppleVision 850AV, Applevision 1710AV PowerMac G3 Server: 400Mhz G3, 512MB/RAM, Dual 40GB RAID 0, Dual 80GB RAID 0, 40GB Boot Drive, DVD/CD Optical Drive, Ultra2 SCSI Card hooked to a DDS-4 Tape Drive, No Monitor PowerMac 8500: Vintage Last edited by yoshi; March 10th, 2002 at 04:54 PM. |
|
#2
| ||||
| ||||
| I've been down this road before, never could get MySQL to actually start. Thanks Yoshi for the how-to, I'l be trying it later on today. I think its critical that we get MySQL and PHP working for every mac os x user who wants it, and I'm glad you wrote a how-to. I hope Swizcore gets this moved to the Archive, because its quite good! |
|
#3
| |||
| |||
| Or you could just uncomment the php lines in the httpd.conf, add index.php to the line with index.htm index.html, and PHP will work. |
|
#4
| |||
| |||
| actually no you couldn't, the php module isn't in apache by default... it wouldn't work right if at all.. trust me I tried.. `Yoshi
__________________ 12" PowerBook G4: 1.5Ghz, 768MB/RAM, 60GB HDD, Combo Drive, 64MB GeforceFX 2 Go, Airport Extreme + BT Quicksilver G4: 1.53Ghz G4, 1GB/RAM, 160GB HDD, SuperDrive, Radeon 9800 Pro (128MB), Airport Card, AppleVision 850AV, Applevision 1710AV PowerMac G3 Server: 400Mhz G3, 512MB/RAM, Dual 40GB RAID 0, Dual 80GB RAID 0, 40GB Boot Drive, DVD/CD Optical Drive, Ultra2 SCSI Card hooked to a DDS-4 Tape Drive, No Monitor PowerMac 8500: Vintage |
|
#5
| |||
| |||
| Actually that is how it works. Know how i know? I actaully did it. After a 10.1 Clean install, I opened up httpd.conf uncommentedthe following lines, restarted Apache and BOOM. PHPworked. Code: LoadModule php4_module libexec/httpd/libphp4.so AddModule mod_php4.c AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps Code: DirectoryIndex index.html Make sure you have a 10.1 Clean install. |
|
#6
| ||||
| ||||
| Very NICE. It all worked. Great! |
|
#7
| |||
| |||
| Quote:
`Yoshi
__________________ 12" PowerBook G4: 1.5Ghz, 768MB/RAM, 60GB HDD, Combo Drive, 64MB GeforceFX 2 Go, Airport Extreme + BT Quicksilver G4: 1.53Ghz G4, 1GB/RAM, 160GB HDD, SuperDrive, Radeon 9800 Pro (128MB), Airport Card, AppleVision 850AV, Applevision 1710AV PowerMac G3 Server: 400Mhz G3, 512MB/RAM, Dual 40GB RAID 0, Dual 80GB RAID 0, 40GB Boot Drive, DVD/CD Optical Drive, Ultra2 SCSI Card hooked to a DDS-4 Tape Drive, No Monitor PowerMac 8500: Vintage |
|
#8
| |||
| |||
| Trouble with MySQL Thank you for the instruction. The PHP install worked out great. However, I'm having trouble with install of MySQL. I've always been a Mac user, but I'm a newbie at Unix. After I did the instructions to install MySQL and restarting, I typed the "mysql test" in the terminal and go this reply. ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) Any suggestions? Could you recommend a good book for using mysql for newcomers to Unix? thanx |
![]() |
| Thread Tools | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP / MySQL | Nynaeve | Mac OS X System & Mac Software | 6 | December 21st, 2005 04:59 PM |
| PHP & mySQL revisited: Help needed | MacLuv | Design & Media | 4 | December 2nd, 2002 10:41 AM |
| PHP + MySQL running but not ZLIB | lashampoo | Mac OS X System & Mac Software | 2 | October 8th, 2001 05:58 PM |