To-do for today’s class
- Download starter file: lect16-intro-php/ (Dropbox)
- Download MAMP (for both Mac and Windows): https://www.mamp.info/en/downloads/
- Both MAMP PRO and MAMP may be downloaded but we will only be using MAMP (the free version). MAMP PRO is not required for this class.
- After opening MAMP, select PHP version 7.4.* on the bottom of the main panel.
- Click on the “Preferences” gear icon on the top left of the main panel.
- In the “General” tab, select the dropdown next to PHP-cache and select “off”. This will prevent MAMP from caching and allow you to see instant updates.
- Click on the “Server” tab.
- Change the Document root folder to the folder that contains all your ITP 303 files. Click on “Choose” button to navigate to the folder and select it.
- Locate the
php.inifile, which is a configuration file that allows you to configure many aspects of PHP.
- Search for
display_errors. You will see a few results. Look for a statement that reads
display_errors = Off, which is around line 472.
- Change this line so that it reads
display_errors = On. Note the capital “O” on On. This will make PHP show errors on the browser while you write PHP. This is super helpful during development.
- You will need to restart the server if you already started the server. If you have never started the server before, click the “Start” icon on the top right of the main panel.
- Give it a few minutes to boot a simulated web server. You will notice a browser tab open up with the URL set to localhost.
- Refer to the official PHP documentation here: http://php.net
Link to download PDF version.