For many, the first need to work with a server comes from having to install WordPress or maybe another CMS (in which case you’ll need a server installed with PHP and MySQL).
In the process of working on any development project, there are huge advantages to doing all of the development work on a “local” version, and then transfer the finished product to the live site once it is ready for production. In order for that to be possible, there are many different “local server environment” applications that create a server, directly on your local machine, without even need for internet to run it. One of the most popular of these is MAMP.
Install MAMP
MAMP stands for Macintosh, Apache, MySQL, and PHP (also Perl and Python), as these are the technologies set to run in its server environment.
The standard version of MAMP is available totally for free, and although there is a Windows-specific version called WAMP, MAMP itself runs on both Mac OS X and Windows.
To download and install MAMP, simply head over to the official downloads page, download the latest version for your operating system, and run the installation.
After running the installation, and starting the application, you should see the following window:
Click “Start Servers”, and wait for the power icon to turn green. If you’re not logged into the superuser/administrator account, you may be asked for the computer’s admin password to make further changes.
Once the power icon turns green, a new page should open up in your browser. If it does not, click on the “Open WebStart page” button.
If you see a page that looks something like below, then you’ve successfully set up your server environment:
Change your project directory
To work with a specific project (say, one with a WordPress installation), click on the “Preference” button on the main MAMP window. Select the “Web Server” tab, and then click the folder icon next to “Document Root”. A pop-up window will appear, asking you to select the root directory of your project. Hit select and then “OK” in the preferences window.
You may need to hit “Start Servers” again if you changed the project directory while the servers were already started.
Test PHP
To test that PHP is correctly running on the server, you can save the following file as index.php
, and then select the containing folder as the document root in MAMP:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" <title>MAMP Demo</title> </head> <body> <p>This is a page to test MAMP</p> <p><?php echo date('Y'); ?></p> </body> </html>
Click on “Open WebStart page” or type in localhost:8888
in your web browser (or just localhost
on Windows), and you should see the following if PHP is correctly running:
Resources
- Web Design Services
- Our custom design process
- WordPress FAQ
- Using node-sass to compile Sass files in an npm script
- Introducing Gutenberg, the new WordPress editor
- Did you just launch a new website? The ultimate guide on what to do next.
- A look at Google Chrome’s New Security Update for 2017
- Should you move your website to WordPress? [Infographic]
- Using Surge for deploying static sites (2018 Update)
- An Introduction to Version Control using Git (2018 Update)
- Sunlight Media is a Top LA Web Designer, Says Research Firm Clutch
- Sunlight Media wins 2018’s Top Software Developers in the US
- Advanced Features of ECMAScript 6: The Ultimate Guide 2018
- Designing a simple navigation bar with Bootstrap 4
- An introduction to the htaccess file:The Ultimate Guide (2018 Update)
- Hottest Conversion Rate Optimization (CRO) Trends in 2017
- The Impact of Your Website’s Loading Speed (InfoGraphic)
- A Quick Guide To Magento Tutorials Available Online
- Making API requests with JavaScript
- Using WOW.js and Animate.css for Scroll-Triggered Animations