Skip to content

Instantly share code, notes, and snippets.

@sadams
Created November 13, 2012 16:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sadams/4066708 to your computer and use it in GitHub Desktop.
Save sadams/4066708 to your computer and use it in GitHub Desktop.
OSX Mountain Lion TagMan MAMP (not "MAMP" the bundle) Notes

OSX Mountain Lion LAMP pear etc Install

If you are really lazy

Install your existing keychains on new mac (there are some files you can just copy, but i can't remember which so maybe give this a go): http://osxdaily.com/2012/07/05/copy-keychain-login-passwords-between-macs/

SSH

  • turn on Remote Login from Sharing in System Preferences
  • Run ssh localhost, the ctrl+c to cancel (cheap way to create the .ssh directory in home dir)
  • Copy private key into .ssh dir and call it id_rsa (make sure perms are 600 or similar)
  • Test by trying to login to somewhere you know is setup with your public key (should allow you to store your password in keychain)

Download and Install

Bash

MAKE SURE YOU DON'T HAVE ANYTHING YOU WANT TO KEEP IN YOUR .bash_profile FIRST

echo "source ~/.bashrc" > .bash_profile

vi ~/.bashrc

Insert the following into .bashrc:

alias ll="ls -laht"
export EDITOR=vi
export PATH=$PATH:/usr/local/mysql/bin
function parse_git_branch {
    ref=$(git symbolic-ref HEAD 2> /dev/null) || return
    echo "("${ref#refs/heads/}")"
}

RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"

PS1="$RED\$(date +%H:%M) \w$YELLOW \$(parse_git_branch)$GREEN\$ "

Then run . ~/.bashrc ('.' does same job as 'source')

git config --global user.name "Your Name Here"

git config --global user.email "your_email@youremail.com"

prevents it from attempting to push all when push is run (only pushes current branch):

git config --global push.default upstream

sets terminal to color output like with git status:

git config --global color.ui true

clone whatever. e.g.

git clone git@github.com:TagManCode/php-api api

Apache2 setup

sudo vi /etc/apache2/httpd.conf

enable the following following lines:

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

SetEnv APPLICATION_ENV 'local'

LoadModule php5_module libexec/apache2/libphp5.so

Installing PEAR stuff

Run the following in terminal

sudo php /usr/lib/php/install-pear-nozlib.phar
pear config-set php_ini /private/etc/php.ini
pecl config-set php_ini /private/etc/php.ini
sudo pear upgrade-all
sudo pear channel-discover pear.phing.info
sudo pear install phing/phing
sudo pear install --force VersionControl_SVN 
sudo pear install --force VersionControl_Git
sudo pear install --force pear/Structures_DataGrid#datasources
sudo pear install --force pear/Structures_DataGrid#renderers
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear install --alldeps pear.phpunit.de/PHPUnit
sudo pear install --alldeps phpunit/PHPUnit_Selenium
sudo pear channel-discover zend.googlecode.com/svn
sudo pear install --alldeps zend/zend

##PHP INI

sudo cp /etc/php.ini.default /etc/php.ini
sudo vi /etc/php.ini

add to the end of the file:

memory_limit = 256M
detect_unicode = Off
display_errors = On
display_startup_errors = On
html_errors = On
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
date.timezone = "Europe/London"
pdo_mysql.default_socket=/tmp/mysql.sock
xdebug.idekey="macgdbp"
xdebug.file_link_format="txmt://open?url=file://%f&line=%1"
xdebug.remote_enable = 1
xdebug.var_display_max_children = 1024
xdebug.var_display_max_data = 10000
xdebug.var_display_max_depth = 112
xdebug.cli_color = 1
include_path=".:/usr/lib/php/pear"

#API vhost: sudo vi /private/etc/apache2/extra/httpd-vhosts.conf And add (replacing [path to public root]):

<VirtualHost *:80>
    DocumentRoot "[path to public root]"
    ServerName api.localhost
    SetEnv APPLICATION_ENV "local"
    <Directory [path to public root]>
        # Disable .htaccess files
        AllowOverride None

        # FollowSymLinks option required for rewrite rules to work
        Options FollowSymLinks

        # Enable access from everywhere by default
        Allow from all

        # Standard Zend Framework rewrite rules
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} -s [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    </Directory>
</VirtualHost>

hosts file

sudo vi /etc/hosts add: 127.0.0.1 api.localhost

##TagMan api specific: mkdir ~/Sites/api/logs; chmod -R 777 ~/Sites/api/logs

Almost the end

sudo apachectl restart

Now create database and users for the databases for the apps

This will create db for you if you have your test db set to same as your application db (see your phing properties file and module ini files):

phing -f build/build.xml -Dbuild=[your profile matching the properties file in build directory] generate_test_db

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