Skip to content

Instantly share code, notes, and snippets.

@pwenzel
Last active March 5, 2025 14:53
Show Gist options
  • Save pwenzel/f06419631bd172331281 to your computer and use it in GitHub Desktop.
Save pwenzel/f06419631bd172331281 to your computer and use it in GitHub Desktop.

Revisions

  1. pwenzel revised this gist Sep 3, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -49,11 +49,13 @@ Create a new site with custom virtual host directives:

    #### Optional: Apache Without VirtualHostX

    You can achieve the above without VirtualHostX by manually editing:
    You can achieve the above without VirtualHostX by [manually editing](http://davidwalsh.name/create-virtual-host):

    /private/etc/hosts
    /private/etc/apache2/httpd.conf
    /private/etc/apache2/extra/httpd-vhosts.conf


    #### MySQL

    With a MySQL client such as [Sequel Pro](http://www.sequelpro.com), connect to MySQL at `127.0.0.1` with the username `root` and no password. [Change the password](http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-generic) if you like.
  2. pwenzel revised this gist Sep 3, 2014. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    This guide shows how to roll PHP and MySQL using OSX's built-in Apache, using [Homebrew](http://brew.sh) to install necessary components. Using this strategy, you can use different versions of PHP for certain virtual hosts.
    This guide shows how to set up a PHP and MySQL development environment using OSX's built-in Apache, using [Homebrew](http://brew.sh) to install necessary components. With this strategy, you can use different versions of PHP for certain virtual hosts.

    [VirtualHostX](https://clickontyler.com/virtualhostx/) is a convenient way to manage development sites, but not required.

    @@ -28,7 +28,8 @@ This should yield `PHP 5.6.0 (cli)`.

    Edit your `~/.bash_profile` by adding the line:

    alias php='/usr/local/Cellar/php56/5.6.0/bin/php'
    alias php='/usr/local/Cellar/php56/5.6.0/bin/php'
    alias php56='/usr/local/Cellar/php56/5.6.0/bin/php'
    Test your PHP alias:

    php --version
  3. pwenzel revised this gist Sep 3, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -66,6 +66,5 @@ Edit `/private/etc/apache2/httpd.conf`:

    User your_mac_username
    Group staff
    # With earlier versions such as Leopard, capitalise staff to Staff


  4. pwenzel revised this gist Sep 3, 2014. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -55,4 +55,17 @@ You can achieve the above without VirtualHostX by manually editing:
    /private/etc/apache2/extra/httpd-vhosts.conf
    #### MySQL

    With a MySQL client such as [Sequel Pro](http://www.sequelpro.com), connect to MySQL at localhost with the username `root` and no password. [Change the password](http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-generic) if you like.
    With a MySQL client such as [Sequel Pro](http://www.sequelpro.com), connect to MySQL at `127.0.0.1` with the username `root` and no password. [Change the password](http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-generic) if you like.


    #### Permissions

    Enable write permissions for Apache by changing its User and Group settings.

    Edit `/private/etc/apache2/httpd.conf`:

    User your_mac_username
    Group staff
    # With earlier versions such as Leopard, capitalise staff to Staff


  5. pwenzel revised this gist Sep 3, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    This guide shows how to roll PHP and MySQL using OSX's built-in Apache, using [Homebrew](http://brew.sh) to install necessary components. Using this strategy, you can use different versions of PHP for certain virtual hosts.

    I use [VirtualHostX](https://clickontyler.com/virtualhostx/) as a convenient way to manage all of my development sites, but it's not required.
    [VirtualHostX](https://clickontyler.com/virtualhostx/) is a convenient way to manage development sites, but not required.

    #### Install PHP and MySQL with Homebrew

  6. pwenzel revised this gist Sep 2, 2014. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,14 @@ I use [VirtualHostX](https://clickontyler.com/virtualhostx/) as a convenient way
    brew install mysql
    mysql.server start

    *The mcrypt extension is required for some PHP frameworks such as [Laravel](http://laravel.com/docs/installation).*

    Optional: Install other extensions or versions of PHP

    brew install php56-xdebug
    brew install php55
    brew install php55-mcrypt

    #### Configure PHP

    Test PHP:
  7. pwenzel revised this gist Sep 2, 2014. 1 changed file with 26 additions and 7 deletions.
    33 changes: 26 additions & 7 deletions lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,31 @@
    #### Run the following Homebrew commands to install PHP and MySQL
    This guide shows how to roll PHP and MySQL using OSX's built-in Apache, using [Homebrew](http://brew.sh) to install necessary components. Using this strategy, you can use different versions of PHP for certain virtual hosts.

    I use [VirtualHostX](https://clickontyler.com/virtualhostx/) as a convenient way to manage all of my development sites, but it's not required.

    #### Install PHP and MySQL with Homebrew

    brew update
    brew install php56
    brew install php56-mcrypt
    brew install mysql
    mysql.server start

    #### Configure PHP

    Test PHP:

    /usr/local/Cellar/php56/5.6.0/bin/php --version

    #### Test and configure PHP
    This should yield `PHP 5.6.0 (cli)`.

    * Run `/usr/local/Cellar/php56/5.6.0/bin/php --version` → should yield `PHP 5.6.0 (cli)`
    * edit `~/.bash_profile` or `~/.config/fish/fish.config`
    * add the line `alias php='/usr/local/Cellar/php56/5.6.0/bin/php'`
    * Run `php --version` → should yield `PHP 5.6.0 (cli)`
    Edit your `~/.bash_profile` by adding the line:
    alias php='/usr/local/Cellar/php56/5.6.0/bin/php'
    Test your PHP alias:

    php --version

    This should again yield `PHP 5.6.0 (cli)`.

    #### VirtualHostX

    @@ -26,6 +38,13 @@ Create a new site with custom virtual host directives:
    DirectoryIndex index.html index.htm index.php


    #### Optional: Apache Without VirtualHostX

    You can achieve the above without VirtualHostX by manually editing:

    /private/etc/hosts
    /private/etc/apache2/httpd.conf
    /private/etc/apache2/extra/httpd-vhosts.conf
    #### MySQL

    With a MySQL client such as [Sequel Pro](http://www.sequelpro.com), connect to MySQL at localhost with the username `root` and no password.
    With a MySQL client such as [Sequel Pro](http://www.sequelpro.com), connect to MySQL at localhost with the username `root` and no password. [Change the password](http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-generic) if you like.
  8. pwenzel revised this gist Sep 1, 2014. 1 changed file with 13 additions and 16 deletions.
    29 changes: 13 additions & 16 deletions lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -1,34 +1,31 @@
    **Run the following Homebrew commands to install PHP and MySQL:**
    #### Run the following Homebrew commands to install PHP and MySQL

    brew update
    brew install php56
    brew install php56-mcrypt
    brew install mysql
    mysql.server start


    **Then test and configure PHP:**
    #### Test and configure PHP

    `/usr/local/Cellar/php56/5.6.0/bin/php --version` (should yield `PHP 5.6.0 (cli)`)
    * Run `/usr/local/Cellar/php56/5.6.0/bin/php --version` → should yield `PHP 5.6.0 (cli)`
    * edit `~/.bash_profile` or `~/.config/fish/fish.config`
    * add the line `alias php='/usr/local/Cellar/php56/5.6.0/bin/php'`
    * Run `php --version` → should yield `PHP 5.6.0 (cli)`

    edit `~/.config/fish/fish.config` or `~/.bash_profile`

    add the line `alias php='/usr/local/Cellar/php56/5.6.0/bin/php'`
    #### VirtualHostX

    `php --version` (should yield `PHP 5.6.0 (cli)`)
    Configure [VirtualHostX](https://clickontyler.com/virtualhostx/) to use Built-in Apache instead of MAMP.



    **VirtualHostX**

    Configure VirtualHostX to use Built-in Apache instead of MAMP.

    Create a new site with custom VirtualHost directives:
    Create a new site with custom virtual host directives:

    LoadModule php5_module /usr/local/Cellar/php56/5.6.0/libexec/apache2/libphp5.so
    AddType application/x-httpd-php .php
    DirectoryIndex index.html index.htm default.htm index.php
    DirectoryIndex index.html index.htm index.php


    **Sequel Pro**
    #### MySQL

    Connect to MySQL at localhost with the username `root` and no password.
    With a MySQL client such as [Sequel Pro](http://www.sequelpro.com), connect to MySQL at localhost with the username `root` and no password.
  9. pwenzel revised this gist Sep 1, 2014. 1 changed file with 8 additions and 3 deletions.
    11 changes: 8 additions & 3 deletions lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -20,10 +20,15 @@ add the line `alias php='/usr/local/Cellar/php56/5.6.0/bin/php'`

    **VirtualHostX**

    Create new site with custom VirtualHost directives:
    Configure VirtualHostX to use Built-in Apache instead of MAMP.

    #LoadModule php5_module /usr/libexec/apache2/libphp5.so
    LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
    Create a new site with custom VirtualHost directives:

    LoadModule php5_module /usr/local/Cellar/php56/5.6.0/libexec/apache2/libphp5.so
    AddType application/x-httpd-php .php
    DirectoryIndex index.html index.htm default.htm index.php


    **Sequel Pro**

    Connect to MySQL at localhost with the username `root` and no password.
  10. pwenzel revised this gist Sep 1, 2014. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -16,3 +16,14 @@ add the line `alias php='/usr/local/Cellar/php56/5.6.0/bin/php'`

    `php --version` (should yield `PHP 5.6.0 (cli)`)



    **VirtualHostX**

    Create new site with custom VirtualHost directives:

    #LoadModule php5_module /usr/libexec/apache2/libphp5.so
    LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
    AddType application/x-httpd-php .php
    DirectoryIndex index.html index.htm default.htm index.php

  11. pwenzel revised this gist Sep 1, 2014. 1 changed file with 11 additions and 7 deletions.
    18 changes: 11 additions & 7 deletions lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,18 @@
    Run the following Homebrew commands to install PHP and MySQL
    **Run the following Homebrew commands to install PHP and MySQL:**

    brew update
    brew install php56
    brew install mysql
    mysql.server start
    brew update
    brew install php56
    brew install mysql
    mysql.server start

    Then test and configure PHP:

    `/usr/local/Cellar/php56/5.6.0/bin/php --version` (verify installation version)
    **Then test and configure PHP:**

    `/usr/local/Cellar/php56/5.6.0/bin/php --version` (should yield `PHP 5.6.0 (cli)`)

    edit `~/.config/fish/fish.config` or `~/.bash_profile`

    add the line `alias php='/usr/local/Cellar/php56/5.6.0/bin/php'`

    `php --version` (should yield `PHP 5.6.0 (cli)`)

  12. pwenzel revised this gist Sep 1, 2014. 1 changed file with 9 additions and 6 deletions.
    15 changes: 9 additions & 6 deletions lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,14 @@
    Run the following Homebrew commands to install PHP and MySQL

    # brew update
    # brew install php56
    # brew install mysql
    # mysql.server start
    brew update
    brew install php56
    brew install mysql
    mysql.server start

    test with `/usr/local/Cellar/php56/5.6.0/bin/php --version` (test)
    Then test and configure PHP:

    `/usr/local/Cellar/php56/5.6.0/bin/php --version` (verify installation version)
    edit `~/.config/fish/fish.config` or `~/.bash_profile`
    add the line `alias php='/usr/local/Cellar/php56/5.6.0/bin/php'`
    test with `php --version` (should yield `PHP 5.6.0 (cli)`)
    `php --version` (should yield `PHP 5.6.0 (cli)`)

  13. pwenzel created this gist Sep 1, 2014.
    11 changes: 11 additions & 0 deletions lamp-stack-osx-virtualhostx.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    Run the following Homebrew commands to install PHP and MySQL

    # brew update
    # brew install php56
    # brew install mysql
    # mysql.server start

    test with `/usr/local/Cellar/php56/5.6.0/bin/php --version` (test)
    edit `~/.config/fish/fish.config` or `~/.bash_profile`
    add the line `alias php='/usr/local/Cellar/php56/5.6.0/bin/php'`
    test with `php --version` (should yield `PHP 5.6.0 (cli)`)