faqts : Computers : Programming : Languages : PHP : General Information : Supported Platforms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

13 of 13 people (100%) answered Yes
Recently 3 of 3 people (100%) answered Yes


Are there plans for an OSX build of PHP? MySQL is already there....

Nov 22nd, 2008 01:40
Raj Aryan, Vip Malixi, Dominique Peretti, Paul Wieland, Onno Benschop, Scott Anguish, René Voorburg, Matthew Vaughn

Link to Precompiled Packages for MacOS X Public Beta, including 
MySQL, PHP, and Apache...
Installing and Making Apache/PHP/MySQl work together on Mac 
OSX v1
Compiled and partly written by Vip Malixi with contributions from 
Scott Anguish, René Voorburg, Matthew Vaughn
1. Be able to log in as Root:
a) Go to the following Folder Applications | Utilities and run 
b) Select menu item -> Domain | Security | Authenticate
c) Enter your password
d) Select menu item -> Domain | Security | Enable Root
e) Enter a password for Root (why not use your own password?)
2. Install the Mac OSX Developer CD 
3. Restart into Mac OS9 (unless you can do the following in Mac 
OSX--in my case, I couldn't) and do the following:
3. Download the files (Note, even if the site offers other packages, 
don't get them, for some reason, they didn't work together, and 
these instructions assume only the files I mentioned):
MySQL : MySQL-3.23.28-1.0.pkg.tar.gz  at http://www-
Apache: apache_1.3.19.tar.gz at http://www.apache.org/dist/httpd/
PHP: php4.0.4.img at http://homepage.mac.com/olav/
4. Run Stuffit Expander to unbinhex php4.0.4.img
5. Mount image php4.0.4.img
6. Copy php-4.0.4pl1.tar.gz to your hard disk
7. Have all files accessible for bringing into Mac OSX:
8. Restart into Mac OSX
9. Copy all these files to your Documents folder which is at /Users/
yourusername/Documents or click on Home then Documents
10. Open Terminal application, which inside Applications | Utilities
11. First install mySQL:
12. Go to Documents folder from Terminal. Type the following at 
the Terminal prompt (the ">" represents the prompt, so don't type 
> cd ~
> cd Documents
> ls
Do you see the files? If you don't, type the following:
> pwd
to check if you're in the right directory: /Users/yourusername/
13. Unpack MySQL:
> gnutar xpfz MySQL-3.23.28-1.0.pkg.tar.gz
14. Go out of Terminal and in Finder, go to your Documents folder 
and double-click on resulting package.
15. Apple's Installer will ask for admin password (click on the 
"lock" icon). Enter your password then run the installer.
16. Quit installer when finished.
17. Go back to Terminal application and type the following:
> su
Enter your Root password
> cd /usr/local/bin
> ./mysql_install_db
18. That's it, MySQL is installed. To run server, type the following at 
Terminal as Root:
> safe_mysqld &
19. Your Terminal will just stop (won't go back to prompt) but that's 
okay. You can close Terminal.
20. I'm assuming you know how to run and use mysql. If you don't 
know how to create a new user aside from Root with database 
creating privileges, this is how: At Terminal, type the following as 
> mysql
Inside mysql, type the following ("m>" represents mysql prompt, 
don't type it):
m> GRANT ALL PRIVILEGES ON *.* TO [email protected] 
IDENTIFIED BY 'whateverpasswordyouwant';
m> quit
Exit root:
> exit
Now to run mysql as you and create a new database, etc., you 
must do the following:
> mysql -pwhateverpasswordyouwant test
m> create database myfirstdatabase
m> quit
> mysql -pwhateverpasswordyouwant myfirstdatabase
21. Install Apache. First turn off Mac OSX Apache. Go to System 
Preference | Sharing, make sure WebServer is off (buttons says 
"Start" instead of "Stop"):
22. Go back to where you placed Apache package. Do this at 
> cd ~
> cd Documents
> gnutar xzf apache_1.3.19.tar.gz
> cd apache_1.3.19
> ./configure --enable-module=most --enable-shared=max
> make
> sudo make install
You'll be asked for Root password. Give it then run.
That's it, you've installed Apache.
23. Let's install PHP next before you run Apache:
24. Go back to where you placed PHP package. Do this at 
Terminal (become Root):
> su
Enter your Root password
Next, configure PHP (the disable pear is because your file system, 
HFS+ is case-insensitive, and installing pear causes errors)
> ./configure --with-mysql --with-apxs --disable-pear
In my case, I also added dBASE support, so if you want, you can 
type the following or add other configurations. Consult PHP.NET 
regarding the others:
> ./configure --with-mysql --with-dbase --with-apxs --disable-pear
> make
> make install
When it's finished, open the following file using at the Terminal 
using the Pico text editor:
> pico /etc/httpd/httpd.conf
Do a search for all things PHP (it's Ctrl-w):
Make sure the following are in there and not commented out 
(comments take the form of "#"), if not add them at the appropriate 
place, which is, together with what looks like them:
LoadModule php4_module		libexec/httpd/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
You may also want to modify the following so that Apache will let 
you go to your PHP page without having to type the file name if it's 
a default:
<IfModule mod_dir.c>
    DirectoryIndex index.html index.php index.php3
25. Okay, finished with PHP.
26. Now do the following to make Apache accessible from 
27. Go to Systems Preference | Network
28. Create a new Location (click on Location pulldown menu and 
select "New...")
29. Call the new Location "Local" or whatever you want, but make 
the following settings:
Configure: Manually
IP Address:
Leave all the other settings the way they are. Save it.
30. Run MySQL (I mentioned this earlier. To check if it's running, at 
the Terminal, type > mysqladmin -v ping). Run Apache: at System 
Preference | Sharing turn on WebServer by clicking on "Start" 
31. Go to your browser, like Ominweb or (blech) Microsoft IE (can't 
wait for Mozilla or Netscape port to OSX):
32. Type at Location: -- you should end up at 
Apache welcome screen.
33. Your programs need to be placed in: /Library/Webserver/
Documents which is accessible from Finder. Try putting in a PHP/
Mysql program and see results in your browser. For example, if I 
place in "first.php" then at browser, you type:
If you put in a folder inside /Library/Webserver/Documents, then 
just use the name of the folder (no spaces) in the browser. 
Example, if folder is called "myprogs":
Phew! Good luck.