Quantcast
Viewing all articles
Browse latest Browse all 10

Apache + PHP on Mac OS X

Though the screenshots have changed the basic process is the same, Kevin Hemenway, takes readers through how to setup an Apache server on Mac OS X and then how to turn on PHP 4.

To edit the httpd.conf I needed to do the following:

1. start Terminal by going to Utilities/Terminal
2. type the following into the terminal:

sudo emacs /etc/http/httpd.conf

3. enter in your admin password
4. Inside emacs, uncomment the line

#LoadModule php4_module

to read:
LoadModule php4_module

and change:
# AddModule mod_php4.c

to read:
AddModule mod_php4.c

Then add the following in the AddType section:

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

5. Save and exit from emacs
CTRL + x, CTRL +s = saves changes use the following keyboard combination
CTRL + x, CTRL +c = exit

6. I created a phpinfo() script using the freeware Taco editor.

< ?php
phpinfo();
?>

7. Want to install MySQL on OS X too? I’ll leave that one for readers (or come back and update this entry or add a new one).

8. I chose to download the MySQL 4.1 binary here. Once downloaded open the package and double click the appropriate package. I chose mysql-max-4.1.18-apple-darwin8.2.0-powerpc.pkg. It will vary based on what type of Mac you have.

9. After install I chose to startup the database manually using the Terminal shell commands:

shell> cd /usr/local/mysql
shell> sudo ./bin/mysqld_safe
(Enter your password, if necessary)
(Press Control-Z)
shell> bg
(Press Control-D or enter “exit” to exit the shell)

You should be able to connect to the MySQL server, for example, by
running `/usr/local/mysql/bin/mysql’.

10. Next, I added an alias for MySQL using bash so I could type “mysql” to get into the databases and “mysqladmin” to use the admin without having to CD to the full path

alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin

11. Voila — in! Now time to secure the MySQL database and enter in a root password

mysqladmin -u root password PASSWORD_HERE

Just change PASSWORD_HERE to the root password you want to use.


Viewing all articles
Browse latest Browse all 10

Trending Articles