So I’ve been playing with Symfony a bit lately, and it’s growing on me. I think I understand most of the “magic,” and am now looking to convince myself that it’s actually safe.
Since the different notes I found through google all have undesirable side effects (IMO), here’s how I did it. My goal was to minimize lasting impact on my system (i.e. I’d like to delete /Applications/MAMP and have everything back to normal, more or less) and minimal deviation from the standard MAMP install.
These notes were taken while setting up symfony 1.0 on MAMP 1.7.
- Download and install MAMP.
- Create a file called “MAMP terminal.command” with the following content:
- Make that file executable.
- Double-click it to get a terminal that has the MAMP stuff on the path. This is where I feel many of the other documented installs went wrong. Most had you symlinking MAMP binaries into /usr/bin! The point of MAMP for me is that it’s a self-contained installation for development purposes. I decidedly do not want it to get in my way when I don’t explicitly tell it to.
- Make sure your pear directories are all safely under /Applications/MAMP:
bash-3.2$ pear config-show Configuration (channel pear.php.net): ===================================== Auto-discover new Channels auto_discover <not set> Default Channel default_channel pear.php.net HTTP Proxy Server Address http_proxy <not set> PEAR server [DEPRECATED] master_server pear.php.net Default Channel Mirror preferred_mirror pear.php.net Remote Configuration File remote_config <not set> PEAR executables directory bin_dir /Applications/MAMP/bin/php5/bin PEAR documentation directory doc_dir /Applications/MAMP/bin/php5/lib/php/doc PHP extension directory ext_dir /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20050922 PEAR directory php_dir /Applications/MAMP/bin/php5/lib/php PEAR Installer cache directory cache_dir /tmp/pear/cache PEAR data directory data_dir /Applications/MAMP/bin/php5/lib/php/data PEAR Installer download download_dir /tmp/pear/cache directory PHP CLI/CGI binary php_bin /Applications/MAMP/bin/php5/bin/php php.ini location php_ini <not set> PEAR Installer temp directory temp_dir /tmp/pear/temp PEAR test directory test_dir /Applications/MAMP/bin/php5/lib/php/test Cache TimeToLive cache_ttl 3600 Preferred Package State preferred_state stable Unix file mask umask 22 Debug Log Level verbose 1 PEAR password (for password <not set> maintainers) Signature Handling Program sig_bin /usr/local/bin/gpg Signature Key Directory sig_keydir /Applications/MAMP/conf/php5/pearkeys Signature Key Id sig_keyid <not set> Package Signature Type sig_type gpg PEAR username (for username <not set> maintainers) User Configuration File Filename /Users/yourusername/.pearrc System Configuration File Filename /Applications/MAMP/conf/php5/pear.conf
Note that you may need to move ~/.pearrc out of the way if you’ve used PEAR outside MAMP on your system in order to get your config to look like this one.
- Install symfony:
bash-3.2$ peardev channel-discover pear.symfony-project.com bash-3.2$ peardev install symfony/symfony
Note that if your user owns /Applications/MAMP you do not need to use sudo here.
- Add an alias to /Applications/MAMP/conf/apache/httpd.conf:
Alias /sf /Applications/MAMP/bin/php5/lib/php/data/symfony/web/sf <Directory "/Applications/MAMP/bin/php5/lib/php/data/symfony/web/sf"> AllowOverride All Allow from All </Directory> - Set up your symfony project
- Set the document root in MAMP (Preferences -> Apache) to /Users/yourusename/mamproot
- Symlink /Users/yourusername/mamproot to your symfony project’s web directory.
- Stop and start Apache.
- Visit http://localhost:8888/ and confirm that you have a nicely decorated symfony welcome page.
Leave a Reply
You must be logged in to post a comment.