MAMP for Laravel
The following instructions are for students are using MAMP instead of Valet for macOS.
NOTE
The following instructions are for MAMP version 6.6. If you are using a different version, please talk to the professor.
NOTE
Using MAMP is a direct replacement for using Valet. Students should NOT use MAMP and Valet at the same time.
Configuring MAMP
1. Download and install the latest version of MAMP
NOTE
If you computer is running macOS 10.11 or older, please talk to the professor.
2. Set the MAMP PHP version to 7.4.21
NOTE
If the PHP version 7.4.21 is not available, please talk to the professor.
3. Set the MAMP Ports to the web and mysql defaults
- From the MAMP application window, click the "Preferences" button.
- Then select the "Ports" tab.
- Then click the "80 & 3306" button.
- Finally, click "OK".
4. Set MAMP to display errors
- In the finder, navigate to Applications/MAMP/bin/php/php7.4.21/conf/
- Open the file php.ini in VS Code
- Inside of VS Code, search for: display_errors
- Keep searching until you find the a line that look like this:
display_errors = Off
- Change Off to On
- Save the file
- Restart the MAMP Server
Installing Composer
1. Open a terminal window and run the following command
If you are using zsh use the following
echo 'export PATH="/Applications/MAMP/bin/php/php7.4.21/bin:$PATH"' >> ~/.zshrc
If you are using bash use the following
echo 'export PATH="/Applications/MAMP/bin/php/php7.4.21/bin:$PATH"' >> ~/.bash_profile
2. Close the Terminal window.
3. Open a new terminal window and run the following command
php -v
NOTE
If the command above returns a PHP version other than 7.4.21, please talk to the professor.
4. In the terminal window, run the following commands
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
5. Close the Terminal window.
6. Open a new terminal window and run the following commend
composer -V
NOTE
If the command above does not return the composer version, please talk to the professor.
Using MAMP for PHP Development
1. Create a course directory
- Navigate to Applications/MAMP/htdocs
- Create a new folder called mtm6405
- Open folder in VS Code
- Create a new file called index.php
- Add the following to the index.php file
<?php phpinfo(); ?>
- Save the file
- In the browser, go to http://localhost/mtm6405/.
2. Working on PHP assignments PHP assignments can be saved directly to the mtm6405 directory created above. To access the projects in the browser, simple add the directory name to the URL used above.
For example, to access the project in the directory system-report-eisenbm, the following url will be used: http://localhost/mtm6405/system-report-eisenbm/
Using MAMP for MySQL Development
MAMP comes with a version of phpMyAdmin. To access it, use the following url:
Using MAMP for Laravel Development
For this course, student will be provided with a repository containing the Laravel source files. The following instructions explain how to install the dependencies and start the Laravel development server.
NOTE
The following steps should not be completed before the Laravel introduction.
1. Open the Laravel project in VS Code.
2. Open a new VS Code terminal, run the following command
composer install
3. Rename .env.example
file to .env
4. In the VS Code terminal, run the following command
php artisan key:generate
5. In the VS Code terminal, run the following command
php artisan serve
This will start the development serve, a URL will be provided to access the site in the browser.