Skip to content

Instantly share code, notes, and snippets.

@shrop
Last active October 11, 2023 20:18
Show Gist options
  • Star 31 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save shrop/3698170 to your computer and use it in GitHub Desktop.
Save shrop/3698170 to your computer and use it in GitHub Desktop.
brewStack Docs

brewStack update for fresh install

Install steps:

  • Install Homebrew:

    • Follow the install instructions found on this page.
  • Tap the wonderful homebrew-php from https://github.com/Homebrew/homebrew-php

      $ brew tap homebrew-php
    
  • Install php with apache and mariadb

      $ brew install mariadb  
      $ brew install php55   
    
  • Add the following to /etc/apache2/httpd.conf

      LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
    
  • Apache 2.4 in OS X Yosemite does not enable mod_rewrite by default. Feel free to enable it if needed.

  • Set the Apache user and group directives to your user shortname and the staff group. Do this in the file /etc/apache2/httpd.conf

    • Restart Apache
    • This allows Apache to host sites in folders other than ~/Sites

Security:

  • Make sure Apache and MariaDB are not accessible outside of your Mac

  • MariaDB

    • Pick a cnf file from /usr/local/Cellar/mariadb//<current-version#>/support-files and copy it to /usr/local/etc/my.cnf.d/

    • I used my-medium.cnf

    • Edit the my.cnf file in the [mysqld] settings area:

    • Comment out:

      ```
      #binary logging is required for replication   
      #log-bin=mysql-bin   
      #binary logging format - mixed recommended   
      #binlog_format=mixed   
      #bind-address=127.0.0.1
      ```
      
  • For enhanced security, you can remove the above and add the following to my.cnf in the [mysqld] settings area. This prevents any TCP/IP connections to MariaDB. This changes will require your applications support database socket connections.

      skip-networking
    
  • Issue the following command and follow the setup instructions to your liking. You will should get prompted by the system firewall to allow or deny mysqld connections when you first start MariaDB. Deny access!

      $ brew info mariadb
    
  • Once you have it setup, issue this commend to start the server manually:

      $ mysql.server start
    
  • Apache

    • Make sure that new vhosts only listen to 127.0.0.1. Same goes for any port.
    • Block all incoming connections to /usr/sbin/httpd using the OS X Firewall settings in System Preferences

Additional setup

  • Helpful bit for your .zshrc to include homebew-php binaries to the system path

      PATH="$(brew --prefix  homebrew/php/php55)/bin:$PATH"
    
  • For large databases, you may need to incrase the max_allowed_packet size in my.cnf to something like the example below:

      max_allowed_packet=1024M
    

VirtualHostX:

@shrop
Copy link
Author

shrop commented Mar 6, 2015

Thanks for all the suggestions. I think they are all implemented. I did some overall readability improvements also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment