Nov 29, 2017

How to install elgg on Openshift

rhc app create elgg php-5.4 mysql-5.5
cd elgg 
git remote add upstream -m master git://github.com/openshift-quickstart/elgg-openshift-quickstart.git
git pull -s recursive -X theirs upstream master
git push

When the installation asks you for your data directory, use the value of the environment variable $OPENSHIFT_DATA_DIR

Source: https://github.com/openshift-quickstart/elgg-openshift-quickstart

Another way:
After create your PHP application on Openshift, Choose:

Making code changes
Install the Git client for your operating system, and from your command line run


git clone ssh://[email protected]/~/git/elgg.git/
cd elgg/

  • Download the latest version of Elgg
  • extract the file to the git folder.
  • git add .
    git commit -m 'My changes'
    git push
When you push changes the OpenShift server will report back its status on deploying your code. The server will run any of your configured deploy hooks and then restart the application.

Create a data folder

Elgg needs a special folder to store uploaded files including profile icons and photos. You will need to create this directory.
Warning
For security reasons, this folder MUST be stored outside of your document root. If you created it under /www/ or /public_html/, you’re doing it wrong.


Create a MySQL database

Using your database administration tool of choice (if you’re unsure about this, ask your system administrator), create a new MySQL database for Elgg. You can create a MySQL database with any of the following tools:
Make sure you add a user to the database with all privileges and record the database name, username and password. You will need this information when installing Elgg.

Add a Database

OpenShift supports several database types out of the box (MySQL, PostgreSQL, and MongoDB).
Click on your application, and then at the bottom of the list of cartridges on the next page you'll see databases you can add.

For database host name, you can ssh to your server and run:
echo $OPENSHIFT_MYSQL_DB_HOST

Visit your Elgg site

Once you’ve performed these steps, visit your Elgg site in your web browser. Elgg will take you through the rest of the installation process from there. The first account that you create at the end of the installation process will be an administrator account.

A note on settings.php and .htaccess

The Elgg installer will try to create two files for you:
  • engine/settings.php, which contains the database settings for your installation
  • .htaccess, which allows Elgg to generate dynamic URLs
If these files can’t be automatically generated, for example because the web server doesn’t have write permissions in the directories, Elgg will tell you how to create them. You could also temporarily change the permissions on the root directory and the engine directory. Set the permissions on those two directories so that the web server can write those two files, complete the install process, and them change the permissions back to their original settings. If, for some reason, this won’t work, you will need to:
  • Copy engine/settings.example.php to engine/settings.php, open it up in a text editor and fill in your database details
  • On Apache server, copy install/config/htaccess.dist to .htaccess
  • On Nginx server copy install/config/nginx.dist to /etc/nginx/sites-enabled and adjust it’s contents