These some tutorials how to install lamp server using MarPorts:
- Install MacPorts:
- Install Xcode
- Launch Xcode > Preferences > Downloads > Install 'Command Line Tools'
- Go to MacPorts website and follow their structure to install MacPorts: http://www.macports.org/install.php
- Install PHP & Apache:
- sudo port install php5 +apache2 +mcrypt +curl +tidy +pear
- sudo port load apache2
- cd /opt/local/apache2/modules
- sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
- sudo cp /opt/local/etc/php5/php.ini-development /opt/local/etc/php5/php.ini
- sudo nano /opt/local/apache2/conf/httpd.conf
- Go to line 119 (In Nano: CTRL+w then CTRL+t and write 119), and enter the following lines:
- AddType application/x-httpd-php .php
- AddType application/x-httpd-php-source .phps
- Now, change DocumentRoot from:
- From: DocumentRoot "/opt/local/apache2/htdocs"
- To: DocumentRoot "/Users/Shin/sites"
- Since we just change the documentRoot folder, we need to adjust some more settings
- From: <Directory “/opt/local/apache2/htdocs”>
- To: <Directory “/Users/Shin/Sites”>
- Now all we have left to do is setting the User and Group. Exchange the following:
- From:
- User www
- Group www
- To:
- User Shin
- Group staff
- sudo /opt/local/apache2/bin/apachectl restart
- Install MySQL:
- sudo port install mysql5 +server
- sudo -u mysql mysql_install_db5
- sudo chown -R mysql:mysql /opt/local/var/db/mysql5/
- sudo chown -R mysql:mysql /opt/local/var/run/mysql5/
- sudo chown -R mysql:mysql /opt/local/var/log/mysql5/
- If that doesn’t work try this:
- sudo mysql_install_db5 sudo chown -R mysql:mysql /opt/local/var/db/mysql5/
- sudo chown -R mysql:mysql /opt/local/var/run/mysql5/
- sudo port load mysql5-server
- sudo ln -s /opt/local/bin/mysql5 /opt/local/bin/mysql
- sudo ln -s /opt/local/bin/mysqladmin5 /opt/local/bin/mysqladmin
- Change new root password:
- mysqladmin5 -u root password 'new-password'
- Some small bugs:
- httpd: Could not reliably determine the server's fully qualified domain name, using <Computer-Name>.local for ServerName
- sudo vim /opt/local/apache2/conf/httpd.conf
- ServerName localhost:80
- If you would like to be able to access web pages in the Sites directory of your home directory
- sudo vim /opt/local/apache2/conf/httpd.conf
- Include conf/extra/httpd-userdir.conf
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- sudo vim /opt/local/etc/mysql5/my.cnf
- [mysqld_safe]
- socket = /tmp/mysql.sock
- [client]
- socket = /tmp/mysql.sock
- sudo vim /opt/local/etc/php5/php.ini
- mysqli.default_socket = "/tmp/mysql.sock"
Good luck!
No comments:
Post a Comment