Skip to content

Instantly share code, notes, and snippets.

@jescalan
Last active December 13, 2015 19:29
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 jescalan/4963458 to your computer and use it in GitHub Desktop.
Save jescalan/4963458 to your computer and use it in GitHub Desktop.
I often run php apps alongside ruby, node, etc. MAMP drives me crazy because it's slow, doesn't work with pow, and only uses it's own mysql install, when i already have a system mysql install for everything else. This is how to get php apps running without MAMP on OSX Lion.

Running PHP Apps Without MAMP on OSX Lion

  1. Create a ~/Sites folder if you don’t already have one
  2. Enable PHP by uncommenting the php5_module line in /etc/apache2/httpd.conf
  3. Find the line that read User _www and change the _www to your username (whoami)
  4. Find the DirectoryIndex line and change it to DirectoryIndex index.php index.html index.htm
  5. Change the DocumentRoot line to DocumentRoot "/Users/yourusername/Sites/"
  6. Change the <Directory line to <Directory "/Users/yourusername/Sites/">
  7. Run sudo apachectl restart
  8. Restart your computer (yes, this is necessary)
  9. PHP sites can be placed in your ~/Sites folder and run and accessed at http://localhost/~username/path/to/project

Notes

If you installed mysql through homebrew, the database connection will always work at the following host path: localhost:/tmp/mysql.sock

If you want to edit the php.ini file, run cp /private/etc/php.ini.default /private/etc/php.ini and make the adjustments necessary.

If you are updating wordpress, you need to chmod all the folders in your project to 777 so the update system can write them. You can use chmod -R 777 . in the project root to do this. You also need to add the line define('FS_METHOD', 'direct'); to your wp-config file.

@pruett
Copy link

pruett commented May 2, 2013

sweet

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