Pow, Apache, Rails, WordPress, and Yosemite

I work on both PHP (WordPress) and Rails sites. It’s important that it is easy to switch contexts and manage all of the different environments. I’m constantly tweaking my dotfiles to make things easier.

I recently updated to Yosemite and ran into some issues getting Apache and Pow to play nicely along with each other. Here were my goals:

Run rails apps through Pow. I want to be able to visit http://myapp.dev/ and spin up my rails app Visit WordPress sites on *.dev domains. I want http://wordpresssite.dev/ to render out my WordPress sites PHP sites need to run on Apache for development/production parity I don’t want to manually edit Apache configuration files each time I add a new site

Here’s the solution that worked for me:

Install Pow. (I use powder) Set POW_DST_PORT in ~/.powconfig Manage pow rails app linking via `powder link` (for convenience) Put all WordPress sites in ~/Sites/thedomain.com Customize your Apache configuration: Remove the default php Apache configuration in /etc/apache2/other Add explicit “Require all granted” to avoid forbidden access errors with Apache 2.4 Redirect all requests to http://thesite.wp.dev/ to ~/Sites/thesite.com Reverse proxy all of the remaining *.dev request to Pow

Continue Reading

PHP, MS SQL, and Linux

Note: this was a draft from 2009. I never finished documenting everything, and I (thankfully!) no longer have to integrate with the MS SQL database mentioned here. However, I figured I throw this information out there in case someone was running into the same configuration issues I was.

Usually I am lucky enough that most of my clients don’t have many of their internal operations tied into their web site’s databases; if they are using MS SQL or some other database engine that isn’t open source I’m able to easily convince them to transfer their data over to MySQL. Recently I was working with a client where this wasn’t the case, there was no way around it: I would have to integrate with a MS SQL database.

Information on connecting to MS SQL from PHP exists on the web, but most of it is either unclear, incomplete, or outdated. I hope to bundle together most of the information I found into one blog post to make it a bit simpler to compile a custom PHP installation with MS SQL capabilities using the freetds library.

In the PHP installation script I changed/added the freetds installation line to this:


cd ${SRCDIR}/${FREETDS} ./configure –prefix=${INSTALLDIR} –with-tdsver=8.0 –enable–msdblib –enable-sybase-compat make make install [/code]


Free TDS User Guide Making PHP With An MS SQL Database ODBC and FreeTDS Unix ODBC

Continue Reading