Skip to content

Instantly share code, notes, and snippets.

@deetergp
Created October 4, 2012 01:39
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 deetergp/3831006 to your computer and use it in GitHub Desktop.
Save deetergp/3831006 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
    
  • Install XQuartz for X11 support in homebrew. While, nothing we are using in this process has anything to do with X11, this package assists the compilation of packages which previously required X11 (Mountain Lion only)

  • 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 --with-intl --with-suhosin
    
  • 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.16/bin/php-cgi ~/bin/  
      $ brew uninstall php53  
    
  • Install php 5.3 with apache, mariadb, intl (for Symfony 2), and suhosin patch

      $ brew install mariadb
      $ brew install php53 --with-mariadb --with-intl --with-suhosin
      $ brew install mongodb
    
  • 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.16/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-mongo  
      $ brew install php53-uploadprogress  
      $ brew install php53-xdebug  
      $ brew install php53-xhprof  
    

make note about php ini files in conf.d area

  • 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 and 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.3.5/share/mysql and copy it to /usr/local/etc/my.cnf
      • I used my-medium.cnf
      • Edit my.cnf and add the following 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.

VirtualHostX:

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