Skip to content

Instantly share code, notes, and snippets.

@robdecker
Forked from shrop/brewStack.md
Created January 14, 2014 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robdecker/8427038 to your computer and use it in GitHub Desktop.
Save robdecker/8427038 to your computer and use it in GitHub Desktop.

brewStack update for fresh install

Install steps:

  • Install Homebrew:

      $ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)  
      $ brew install git  
      $ brew update  
      $ brew install drush
    
  • Tap the wonderful homebrew-php from https://github.com/josegonzalez/homebrew-php

      $ brew tap josegonzalez/homebrew-php
      $ brew tap homebrew/dupes
    
  • Generate php-cgi for use with drush-qd.

      $ brew install php53 --without-apache --with-mariadb
    
  • Backup php-cgi and uninstall php53 since you homebrew-php will not install php-cgi and lib5php.so at the same time

      $ cp /usr/local/Cellar/php53/5.3.22/bin/php-cgi ~/bin/  
      $ brew uninstall php53  
    
  • Install php 5.3 with apache and mariadb

      $ brew install mariadb  
      $ brew install php53 --with-mariadb   
    
  • Now that php 5.3 is compiled for Apache, you can copy the php-cgi binary compiled previously to ~/bin or any other bin directory in the current path.

  • Add the following to /etc/apache2/httpd.conf

      LoadModule php5_module /usr/local/Cellar/php53/5.3.27/libexec/apache2/libphp5.so
    

note change the version # above based on which version of php has been installed by homebrew-php

  • Install additional php extensions (Optional. Follow configuration instructions after each install.)

      $ brew install php53-apc  
      $ brew install php53-intl
      $ brew install php53-memcache
      $ brew install php53-mongo
      $ brew install php53-uploadprogress  
      $ brew install php53-xdebug  
      $ brew install php53-xhprof  
    
  • If you want to use memcache or mongodb, make sure to install the cooresponding services

      $ brew install memcached
      $ brew install mongodb
    
  • Install composer for Symfony and other PHP package management

      $ brew install composer
    
  • Set your timezone for php. I used the following in /usr/local/etc/php/5.3/php.ini.

      date.timezone = America/New_York
    
  • Set the following for Symfony 2 compatibility in /usr/local/etc/php/5.3/php.ini:

      detect_unicode = off
    
  • Set the Apache user and group directives to your user shortname and the "admin" 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/5.5.29/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

    • Edit /etc/apache2/httpd.conf, replacing "listen 80" with

      listen 127.0.0.1:80

  • 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

VirtualHostX:

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