OS X: Configuring webserver (+for Laravel)

When developing in Windows I’m using Wampserver. When switching to OS X I started searching for an alternative and found some possible solutions. After testing some, I found AMPPS to be the best alternative because of the ease of adding domains. For optimal usage and developing with Laravel, it requires some extra configuration.

Using the PHP & MySQL from AMPPS

By default OS X uses it’s own PHP (and possibly MySQL) installation. In AMMPS it’s really easy to switch the PHP version and it would be useful the terminal uses the same PHP version. So let’s tell OS X to use these binaries.

  1. Edit .bash_profile with your favorite editor (nano, vim, etc.)
  2. Add:
    export PATH="/Applications/AMPPS/php/bin:/Applications/AMPPS/mysql/bin:$PATH"
  3. Close and reopen the terminal
  4. Execute:
    which php

    It should point to /Applications/AMPPS/php/bin/php

Developing with Laravel

Laravel requires some extra configuration.

Required PHP version

Laravel requires at least PHP 5.5.

  1. Open the AMPPS interface
  2. Head to the “PHP” section
  3. Click “Change PHP Version”
  4. Check PHP 5.5 or PHP 5.6
  5. Click “Apply”

Enable required PHP extensions

Laravel requires some PHP extensions.

  1. Open the AMPPS interface
  2. Head to the “PHP” section
  3. Click “Php Extension”
  4. Enable the following extensions:

    bz2.so
    ctype.so
    curl.so
    gd.so
    mbstring.so
    mcrypt.so
    mongo.so
    mysql.so
    mysqli.so
    openssl.so
    pdo_mysql.so
    pdo_sqlite.so
    soap.so
    sockets.so
    sqlite3.so
    tokenizer.so
    zlib.so

You can now use Laravel.

Leave a Reply

Your email address will not be published. Required fields are marked *