Monday, January 07, 2013

Configuring PHP Values for OpenShift

This is probably basic stuff for you PHP experts out there, but recently I was doing some work to upgrade my ownCloud instance that's sitting in OpenShift.

There were some significant changes in the upgrade which required completely replacing the php directory - at least according to the upgrade instructions on ownCloud's site.

This was a fairly smooth process as I made sure I had checked out my latest deployed instance on OpenShift. Then, I removed everything in the PHP directory but the config and copied in the latest ownCloud version, committed the changes and watched the OpenShift magic automatically deploy the new CodeBase.

Well almost. I ran into an issue where the session.save_path php variable was not set to a writeable directory. Simple enough fix, just modify the php.ini to do this - except on OpenShift. The next place to set this then is to configure it in a .htaccess file. So in the .htaccess file I added -- 'php_value session.save_path /tmp' and then did an rhc app restart owncloud -l. Viola, I'm off and running again.

To fix it correctly, I need to modify the .htaccess to use one of the environment variables for openshift - most likely OPENSHIFT_TMP_DIR, but for now this works and I can tinker with the latest bits of ownCloud.

So in the future, if you need to modify a PHP variable, make sure to use the .htaccess file for this.

Now my next thing is to make sure that I modify the ownCloud openshift quickstart to use the latest code.

Post a Comment