MAMP.ONE

web publishing magazine

How to install Laravel in to a MAMP PRO document root

  1. Install Composer (See https://getcomposer.org/doc/00-intro.md)
  2. Create a host laravel.test with database laravel_test in MAMP PRO
  3. Open the terminal and cd to the document root of the laravel.test host
  4. type the following in the terminal (without quotes): “composer create-project –prefer-dist laravel/laravel .” <- Make sure not to forget the dot!
  5. After installation, open the hidden file .env (which is located in the document root) in any text editor of your choice
  6. Setup the db section like this:

DB_CONNECTION=mysql
DB_HOST=localhost;unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock
DB_PORT=3306
DB_DATABASE=laravel_test
DB_USERNAME=root
DB_PASSWORD=root

If you have a different user and password for mysql you need to use these instead of root/root

7. Open the file config/database.php and set database there too:

‘mysql’ => [
‘driver’ => ‘mysql’,
‘host’ => env(‘DB_HOST’, ‘localhost’),
‘port’ => env(‘DB_PORT’, ‘3306’),
‘database’ => env(‘DB_DATABASE’, ‘laravel_test’),
‘username’ => env(‘DB_USERNAME’, ‘root’),
‘password’ => env(‘DB_PASSWORD’, ‘root’),
‘unix_socket’ => env(‘DB_SOCKET’, ‘/Applications/MAMP/tmp/mysql/mysql.sock’),
‘charset’ => ‘utf8mb4’,
‘collation’ => ‘utf8mb4_unicode_ci’,
‘prefix’ => ”,
‘prefix_indexes’ => true,
‘strict’ => true,
‘engine’ => null,
‘options’ => extension_loaded(‘pdo_mysql’) ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env(‘MYSQL_ATTR_SSL_CA’),
]) : [],
],

8. Copy the hidden “.htaccess” file from the “public” folder directly in the document root of your laravel.test host

9. Rename server.php into index.php

Thats it. Now you should be able to call http://laravel.test to see the starting page of laravel

To add the default databases and tables you need to migrate them. This is done like this:

  1. Be sure MAMP PRO is running
  2. Open the terminal and cd to the document root of the laravel.test host
  3. Type “php artisan migrate”

You should see something like this:

Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table

Now everything works like described in the documentation of laravel (e.g. installing new modules, creating new migrations, etc)

If you make changes in one of the config files you always need to cd to the document root of the laravel.test host and call “php artisan config:cache” in the terminal


MAMP & MAMP PRO —
Version 5.1 released

We’ve just released version 5.1 of MAMP & MAMP PRO. This update is available for download and contains some bug fixes and improvements.

MAMP & MAMP PRO

  • Updated components
    • MySQL 5.7.23
    • phpMyAdmin 4.8.3
  • New components
    • Extensions to use Redis from PHP, Perl, Python & Ruby

MAMP

  • Fixed a crash when retrieving the MySQL password

MAMP PRO

  • The Create Snapshot toolbar item gets highlighted again when a snapshot is being created.
  • The Memcached and Redis extensions for PHP are now only enabled when GroupStart is enabled for these servers.
  • PHP versions can be removed from inside MAMP PRO.
  • Fixed a crash when reading the user ID
  • Edit windows support proxy icons in the titlebar – when possible.
  • The checkbox “Automatically resolve aliases and symbolic links” now works correctly in open dialogs.
  • You can no longer create snapshots if there is not enough free disk space.
  • Host-specific ports are no longer ignored.
  • Fixed a crash when creating/restoring a snapshot
  • Added MySQL user “mamp” as a “root” stand-in for emergencies

Don’t hesitate to report any other bug you may find to our bugbase so we can fix it as quickly as possible.


Take five!

MAMP & MAMP PRO Version 5 for macOS out now and contains a wealth of new features and improvements to make your work as a web developer much easier: Transfer your WordPress projects directly from MAMP PRO to your live server, or import an existing WordPress site into MAMP PRO. * Even a server migration is now possible without great effort. The new snapshot function allows you to save development steps and restore them at any time as needed. Use the new Host View to group your hosts into folders. And many more.

Users of version 4 get a reduced upgrade price.

* For WordPress publishing and importing functions, please check system requirements.