Install and configure Apache, Mysql and PHP on Mac OS X Lion 10.7
Apache
Check apache version:
httpd -v
Edit httpd.conf file:
sudo vim /etc/apache2/httpd.conf
Uncomment:
LoadModule php5_module libexec/apache2/libphp5.so
Start and stop apache:
sudo apachectl start
sudo apachectl stop
sudo apachectl graceful
Html-Docfolders
- http://localhost -> /Library/WebServer/Documents/
- http://localhost/~username/ -> /Users/username/Sites/
User Level Root
cd /etc/apache2/users
sudo vim username.conf
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
PHP
Check php version:
php -v
Create /etc/php.ini
.
sudo cp /etc/php.ini.default /etc/php.ini
Fix mysql.sock location in php.ini. In /etc/php.ini, replace the three occurences of /var/mysql/mysql.sock by /tmp/mysql.sock
pdo_mysql.default_socket = /tmp/mysql.sock
mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock
Mysql
Download on mysql.com the DMP-File: Mac OS X ver. 10.6 (x86, 64-bit)
Install
- mysql5.5.xxx.pkg
- MySQLstartupitem.pkg
- MySQLPrefPane
Check mysql version:
/usr/local/mysql/bin/mysql -v
Edit .bash_profile
vim .bash_profile
Add this line:
export PATH="/usr/local/mysql/bin:$PATH"
Now this command should be work:
mysql -v
Set root password:
mysqladmin -u root password 'root'
A more secure way:
sudo mysql_secure_installation