How to Set Up for PHP Training
Whether you are using a PC with Windows or a Mac, you should install MAMP for the PHP course.
MAMP is a free distribution package that makes it easy to install Apache Web Server, PHP, and MySQL. Before installing MAMP, you should turn off any other web servers and instances of MySQL you have running on your computer.
These instructions will walk you through:
- Downloading MAMP.
- Running MAMP on Windows / Mac
- Downloading and unzipping the class files.
- Setting the MySQL password.
- Installing the poetree database.
- Testing your setup.
- Download, Install, and Set Up Visual Studio Code
Recommended Code Editor
While you may use a different editor or IDE, we highly recommend using Visual Studio Code. Visual Studio Code is an excellent IDE to learn to code on. It provides a nice balance of power and simplicity and it is available on Windows and Mac. When you have finished the instructions on this page, learn how to download, install, and set up VS Code.
- Download the latest version of MAMP. Be sure to choose the version for your operating system:
- Run the downloaded file (e.g., MAMP_MAMP_PRO_4.1.exe for Windows ro MAMP_MAMP_PRO_5.2.pkg for Mac) and click through the installation wizard.
- If prompted, you do not need to install MAMP PRO or Apple Bonjour.
- Accept the License Agreement.
- Accept all the defaults.
- Close the wizard when setup is finished.
Running MAMP on Windows
To run MAMP on Windows...
- Navigate to C:\MAMP in Windows Explorer and open MAMP.exe. If you get a security alert, allow access. You should see a window like this one: The servers (Apache Server and MySQL Server) should have automatically started. If they did not, start them by clicking on Start Servers.
- Open MAMP Preferences:
- Change the Apache port to 8888:
- Click on Open WebStart Page: The following page should open in your browser:
Running MAMP on Mac
To run MAMP on Mac...
- Navigate to /Applications/MAMP in Finder and open MAMP.app. If you get a security alert, allow access. You should see a window like this one: Start the servers (Apache Server and MySQL Server) by clicking on Start Servers.
- The MAMP WebStart page should automatically open. If it does not, click on Open WebStart Page: The following page should open in your browser:
- Download the class files...
- Windows users...
- Create a folder in C:\MAMP\htdocs named "Webucator"
- Download the class files anywhere you like (e.g, the Downloads folder).
- Extract your class files into the new Webucator folder:
- Mac users...
- Create a folder in /Applications/MAMP named "Webucator".
- Download the class files into the new Webucator folder.
- Double click on the downloaded zip file to extract your class files into the new Webucator folder.
- Windows users...
- You can now delete the zip file.
- Rename the ClassFiles folder to php:
- To test that your setup so far is correct, open your browser and navigate to http://localhost:8888/Webucator/php/. You should get a listing like this:
- Click PHPBasics, then click Demos, and then hello-world.php. You should get a page that looks like this:
Setting the MySQL Password
The PHP files use "pwdpwd" for the MySQL root password, while the default password used in MAMP is "root". In your browser, navigate to http://localhost:8888/phpMyAdmin/.
Note: It is important to do these steps in the order specified.
- Click the mysql database on the left.
- Click the SQL tab at the top.
- Enter the following in the textbox under Run SQL query/queries on database mysql:
SET Password = 'pwdpwd'
- Click Go.
- You also need to update the password in phpMyAdmin:
- Windows: Open C:\MAMP\bin\phpMyAdmin\config.inc.php in your editor (e.g., Visual Studio Code)
- Mac: Open /Applications/MAMP/bin/phpMyAdmin/config.inc.php in your editor (e.g., Visual Studio Code)
- Change the password setting as show below to 'pwdpwd'.
Installing the poetree Database
Use phpMyAdmin to install the poetree database used in class.
- Click on the Import tab heading
- Click the Choose File button.
- Browse to the poetree-db.sql file in your class files (C:\MAMP\Webucator\php\poetree-db.sql or /Applications/MAMP/Webucator/php/poetree-db.sql).
- Click Open:
- Click the Go button on the bottom left of the page.
- You should get a Success message and poetree should be added to your list of Databases.
Testing the Setup
Point your browser to http://localhost:8888/Webucator/php/Database/Solutions/phppoetry.com/. If you see a page like this, you're all set:
And that's it for MAMP
Happy MAMPing! Don't forget to go download, install, and set up VS Code.