Many people use predefined packages to run a local webserver, but Apples operating system brings nearly all of the required stuff to do this out of the box. The rest is installing MySQL (or a other DBMS of your choice) and a little configuring here and there.
After you completed all steps you considered necessary, start/restart your Apache Webserver aka Web Sharing via "System Preferences > Sharing > Web Sharing" or by typing sudo apachectl start/sudo apachectl restart into Terminal App.
You should now be able to access PHP-Scripts, PHP-Apps, etc. that you put into the Sites-folder inside your user-folder with your browser via http://your-computers-name/~your-(short)-username/.
Apache
Tell Apache to load the PHP-Module
- Open
/etc/apache2/httpd.conf - Uncomment the line
LoadModule php5_module …
Activate the mod_rewrite-module
- Open
/etc/apache2/httpd.conf - In the
<Directory>-section, changeAllowOverride NonetoAllowOverride All - Open
/etc/apache2/users/your_username.conf - In the
<Directory>-section, addFollowSymLinksto theOptions-line and make shureAllowOverride Allis activated
MySQL
- Download the latest MySQL version
- Install the MySQL-.pgk
- Install the pref-pane
- Start MySQL via "System Preferences > MySQL > Start MySQL Server" or by typing
sudo /usr/local/mysql/support-files/mysql.server startinto the terminal
PHP
Fix mysql.sock location
- Open
/private/etc/php.ini.default - Replace all three occurences of
/var/mysql/mysql.sockwith/tmp/mysql.sock - Save the file as
php.ini
Fix date.timezone-warning
- Open
/private/etc/php.ini - Uncomment the line
date.timezone = - Add your timezone, for example
date.timezone = "Europe/Berlin"
Activate PHP short tags
- Open
/private/etc/php.ini - Change the line
short_open_tag = Offtoshort_open_tag = On
References
- http://php.net/manual/en/timezones.php
- http://www.glenscott.co.uk/2009/08/30/fix-php-timezone-warnings-in-os-x-snow-leopard/
- http://stackoverflow.com/questions/1293484/easiest-way-to-activate-php-and-mysql-on-mac-os-10-6-snow-leopard
- http://teeparham.posterous.com/configure-apache-for-mod-rewrite-on-mac
1 Comment(s)
Jul 24
at 2:23
Das ist wirklich mein Problem gelöst, danke!