Make Better WordPress Minify Work On OpenShift

Read {count} times since 2020

If you run a WordPress blog on OpenShift, you might not be able to run the Minify plugins. These plugins won’t work if your OpenShift app is directly installed from the WordPress catridge they provide. This happens because the plugins, themes and other directories of wp-content are linked directories which means they’re fake. The folders are just shortcuts of the original folder situated in app-root/data. This makes the minify plugin hard to find the source of the file. Hence it won’t work.

This happened to my blog and I looked in to the source files of plugin and found a solution. You can solve this problem with only 5 lines of code !

Editing bwp-minify/min/index.php

The changes we are going to make to fix the problem are on the bwp-minify/min/index.php file of the plugin. You can use SFTP to edit the file or you can use the Plugin Editor of WordPress.


See the tutorial to know how to use File Transfer Protocol (FTP) to access the source code of you app running on OpenShift.

Connect to your site’s FTP server and go to the following location :


Open the file index.php from the directory using your text editor.

WordPress Plugin Editor

Go to wp-admin/plugin-editor.php page. Choose Better Wordpress Minify from "plugin to edit" field. Then choose


from the files section shown on right side of window.


Search the file for the following line :


Add the following code just above the line you just searched :

 $_SERVER['DOCUMENT_ROOT'] = "/var/lib/openshift/app-id/app-root";

Make sure that you have replaced the app-id with your application’s id. You can get your app id from the Web URL of your app on Openshift Console. An example URL :

From the above URL, the id of the app is 527de613e0b8cdef8d000212 found just after the "application/" and end at the "-" sign.

And the whole code of that area would be :

 $_SERVER['DOCUMENT_ROOT'] = "/var/lib/openshift/app-id/app-root";
$min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;

Save the file. Now, Enable the plugin if it’s deactivated. Open your blog and you will see the magic. If there are any problems, then please comment it on the comments section below. I will be here to help you out.

Show Comments