Coder Social home page Coder Social logo

k1462015 / openshift-cartridge-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from boekkooi/openshift-cartridge-php

0.0 2.0 0.0 179.51 MB

License: MIT License

Shell 10.19% HTML 1.13% C 64.17% C++ 22.62% Awk 0.04% PHP 1.11% Objective-C 0.01% Makefile 0.12% Assembly 0.01% Java 0.20% XSLT 0.39%

openshift-cartridge-php's Introduction

Openshift PHP Plugin Cartridge

Welcome to the world of PHP-FPM within openshift.

Currently this cartridge works well the boekkooi NGINX cartridge.

You can add this cartridge to your application using:

rhc cartridge add -a myapp http://cartreflect-claytondev.rhcloud.com/github/boekkooi/openshift-cartridge-php

If you want to install a specific PHP version you can add --env OPENSHIFT_PHP_VERSION=<version> to the command. For example to install PHP 5.5.22 you can use:

rhc cartridge add -a myapp --env OPENSHIFT_PHP_VERSION=5.5.22 http://cartreflect-claytondev.rhcloud.com/github/boekkooi/openshift-cartridge-php

Versions

Currently this cartridge has the following versions:

  • PHP 5.5.22
  • PHP 5.6.16

If you need another version you can compile it yourself and submit a PR to get it integrated.

Configuration

For the best result with this cartridge you are advised to create a .openshift/action_hooks/build and add the following to it:

#!/bin/bash
set -e

# Build PHP extra's
# Update conf/ini files and install pecl extensions
${OPENSHIFT_PHP_DIR}/bin/control build

Now it's time to configure nginx edit your .openshift/nginx.conf.erb and add the following within the server section:

# pass the PHP scripts to PHP-FPM
location ~ \.php$ {
    fastcgi_pass unix:<%= ENV['OPENSHIFT_PHP_SOCKET'] %>;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_script_name;
    include <%= ENV['OPENSHIFT_NGINX_DIR'] %>/usr/nginx-<%= ENV['OPENSHIFT_NGINX_VERSION'] %>/conf/fastcgi_params;
}

PHP.ini etc.

If you have created .openshift/action_hooks/build you can fully customize the PHP configuration. In your application create the following directories:

.openshift/cli/
.openshift/fpm/

In the cli directory create the php.ini.erb file and copy the content from conf/php.ini.erb into it. Now you can customize the cli php configuration.

In the fpm directory create the php.ini.erb file and copy the content from conf/php-fpm.ini.erb into it. Also create the php-fpm.conf.erb file and copy the content from conf/php-fpm.conf.erb into it. Now you can customize the php-fpm configuration.

Composer/PEAR

Composer is installed by default and can be used by simply ssh to your application and typing in composer.

So where is PEAR? It's not there! Why? Read The rise of Composer and the fall of PEAR. If you really need PEAR then download it your self using php go-pear.phar and pray it work. Any PR's related to PEAR or failure to install it will be ignored

PECL

If you have created .openshift/action_hooks/build you can create the .openshift/php-pecl.txt to auto install pecl extensions. This file must constain have a pecl extension name and version per line for example:

apcu 4.0.7
mongo 1.6.5

Note for Openshift online: even though the scripts should automatically add the extension declaration in the php.ini files, if you have custom ini.erb files the extension declaration might be overwritten when they are deployed. In that case you must declare the extension manually in your .ini.erb files.

Phalcon

There is special support for phalcon you can simply install it by adding the following to your .openshift/php-pecl.txt file.

phalcon 1.3.4 --enable-phalcon

Don't forget to change your .openshift/nginx.conf.erb according to the phalcon nginx installation notes.

Compiling a new version

To compile a new version you will first need a openshift application.

rhc create-app nginx http://cartreflect-claytondev.rhcloud.com/github/boekkooi/openshift-cartridge-nginx

Now clone the repository and create a php folder. Now copy the usr/compile directory from this repository. Now set the versions you need to compile in the php/compile/versions file. Commit and push the application repository.

SSH into your app and go to the compile folder (cd ${OPENSHIFT_REPO_DIR}/php/compile) and start compiling by running the following commands:

./libs
./php
./libs_package

Once compiling is done you can download the php-{version}.tar.gz from you application. Extract the php-{version} from the archive and place them into the openshift-cartridge-php/usr folder. Last but not least edit the openshift-cartridge-php/manifest.yml and add the versions.

All done just commit and push to your openshift-cartridge-php repo and use:

rhc cartridge add -a myapp http://cartreflect-claytondev.rhcloud.com/github/<user>/openshift-cartridge-php

Updates

Updating this cartridge is not as easy as I would like because openshift online won't allow updates for downloaded cartridges. To update the cartridge you can do the following:

rhc cartridge remove -a myapp --confirm  php
rhc cartridge add -a myapp http://cartreflect-claytondev.rhcloud.com/github/<user>/openshift-cartridge-php

This will remove the old version and install the latest version.

openshift-cartridge-php's People

Contributors

boekkooi avatar lucho2d7 avatar rscorer avatar

Watchers

James Cloos avatar Tahmidul Islam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.