Local server and mySQL server

ant


Joined
Jun 7, 2009
Messages
4
Reaction score
0
Points
1
Hello everyone
I need to start a local server and mySQL server on my macbook to test a website. Any suggestings what software should I use?

Thanks in advance.
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Apache 2 comes preloaded, you just have to start it up and set the configuration file to allow execution of your scripts as per any Apache install. You turn it on via the "Web Sharing" option under the Sharing tab of System Preferences.

Go to the mysql site and download the appropriate version package for your version of OS X, hardware and bits (32/64). Follow the Readme.txt file.

If you are using PHP, you'll have to edit the httpd.conf file.

In the readme they mention securing the root account and reference "*Note
post-installation::". I think you want to see "2.11.3. Securing the Initial MySQL Accounts" of the reference manual for the details.

You might also want to install MySQL Workbench.
 
Joined
Mar 31, 2010
Messages
6
Reaction score
0
Points
1
Apache/MySQL Set Up Instructions for Snow Leopard

Step 1 - Creating your site

1. Type the following in Terminal:

Code:
cd /Users/yourname/Sites
mkdir mysite.com
cd mysite.com
printf "My awesome site" > index.html

Step 2 - Setting up Apache:

1. Open /etc/apache2/httpd.conf in a text editor
2. Change

Code:
#Include /private/etc/apache2/extra/httpd-vhosts.conf

to

Code:
Include /private/etc/apache2/extra/httpd-vhosts.conf

3. Open /etc/apache2/extra/httpd-vhosts.conf in a text editor and at the bottom add:

Code:
<VirtualHost *:80> 
  <Directory /Users/yourname/Sites/mysite.com> 
    AllowOverride All 
  </Directory> 
  DocumentRoot /Users/yourname/Sites/mysite.com 
  ServerName mysite.local 
</VirtualHost>

Step 3 - Setting your hosts file

1. Open /etc/hosts in a text editor
2. Add the following as it relates to your ServerName in Step 2

Code:
127.0.0.1 mysite.local

3. Start Apache from Terminal:

Code:
sudo apachectl start

4. If you see

Code:
org.apache.httpd: Already loaded

Then restart Apache:

Code:
sudo apachectl restart

Step 4 - Enable PHP

1. Open /etc/apache2/httpd.conf in a text editor
2. Change:

Code:
#LoadModule php5_module libexec/apache2/libphp5.so

to

Code:
LoadModule php5_module libexec/apache2/libphp5.so

3. Restart apache in Terminal:

Code:
sudo apachectl restart

4. Test PHP:

Code:
cd /Users/yourname/Sites
cd mysite.com
printf "<?php phpinfo() ?>" > index.php

5. Go to http://mysite.local/index.php and if you see phpinfo then php was successfully enabled and Apache is set up.

Step 5 (optional) - Enable Error Reporting Output in Browser

This is optional but very useful if you want to know what line the PHP fails at and the associated error message. I would recommend this for testing/personal use.

1. Open /private/etc/php.ini in a text editor
2. Find the section entitled "Error handling and logging"
3. Uncomment the following directive within the section and set it to on:

Code:
display_errors = On

4. Restart apache in Terminal:

Code:
sudo apachectl restart

Step 6 - Installing MySQL

1. Download the MySQL package for Mac OS X.5 (32 or 64 bits depending on your machine)
2. Install everything in the package in this order: mysql, the startup item, the preference pane.
3. Start MySQL in the preference pane.
4. Fix mysql.sock location in /etc/php.ini, replace the three occurrences of

/var/mysql/mysql.sock

with

/tmp/mysql.sock

5. Restart apache in Terminal:

Code:
sudo apachectl restart


That should get you running...I just recently set up my MacBook Pro and these are the instructions I put together from a host of websites.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top