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.

Setting PHP in MAMP

3. Set the MAMP Ports to the web and mysql defaults

  1. From the MAMP application window, click the "Preferences" button.
  2. Then select the "Ports" tab.
  3. Then click the "80 & 3306" button.
  4. Finally, click "OK".

Setting ports in MAMP

4. Set MAMP to display errors

  1. In the finder, navigate to Applications/MAMP/bin/php/php7.4.21/conf/
  2. Open the file php.ini in VS Code
  3. Inside of VS Code, search for: display_errors
  4. Keep searching until you find the a line that look like this:
display_errors = Off

The php.ini file for MAMP

  1. Change Off to On
  2. Save the file
  3. 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

The terminal showing the PHP Version

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

Terminal window showing Composer version

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

  1. Navigate to Applications/MAMP/htdocs
  2. Create a new folder called mtm6405
  3. Open folder in VS Code
  4. Create a new file called index.php
  5. Add the following to the index.php file
<?php phpinfo(); ?>

Creating a PHP file in course directory

  1. Save the file
  2. In the browser, go to http://localhost/mtm6405/.

Viewing course directory in browser

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:

http://localhost/phpMyAdmin5/

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.