This cartridge can be used as a base to develop PHP applications relying on PHP frameworks requiring Composer to download dependencies (such as the ZendFramework or Symfony). The PHP version can be configured. By default, the FastCGI Process Manager (FPM) compilation option is enabled.
- Create a do-it-yourself application in Openshift (see https://openshift.redhat.com/app/console/application_type/cart!diy-0.1)
- Fill the Source Code text field with: https://github.com/JVerstry/openshift-php-framework-stack
- Click Create Application and wait until ready
- If you want to modify the PHP version to be built, clone the application's git repository locally, update
DIST_PHP_VER
in/misc/make.sh
, then git commit and push this modification - If the PHP version to compile is less than 5.3.3, remove the fpm compilation options in
/misc/make_php
and git commit and push this modification - Visit your application's main page (e.g. https://myapp-mydomain.rhcloud.com/)
- Click the last link to start the build, it will take about an hour
- To activate Composer, clone the application's repository locally (or pull changes if you have already cloned it) and rename the
_deploy
file todeploy
in the/.openshift/action_hooks/
directory - Commit this file
- Make it executable with
git update-index --chmod=+x .openshift/action_hooks/deploy
- Commit this file again and push it too when the build is finished
- Starting coding your PHP application
To demonstrate the usage of Composer, we will install the ZendFramework skeleton application:
- Delete the
index.cgi
file in the/public
directory - Rename the
_deploy
file todeploy
in the/.openshift/action_hooks/
directory if you have not done so already - Commit this file
- Make it executable with
git update-index --chmod=+x .openshift/action_hooks/deploy
- Commit this file again and push it too
- Download the ZendFramework skeleton application as a
.zip
file from https://github.com/zendframework/ZendSkeletonApplication - Unzip this file at the root of your git repository (i.e., the content of
/public
in the.zip
must be poured in your local/public
directory) - Commit and push all modifications
- During the git push, Composer will download all dependencies found in
composer.json
- Visit your application's main page (e.g. https://myapp-mydomain.rhcloud.com/)
A similar procedure can be used for other PHP frameworks.
The Apache server configuration can be found and modified in /conf/httpd.conf
.
When you log into your application (with ssh for example), and type php -v
after the installation,
the returned version is the one of the default Openshift PHP installation in: /usr/bin/php
. That
is to be expected.
Your PHP files will, nevertheless, be processed with the version configured in
/misc/make.sh
. More information here: https://github.com/JVerstry/openshift-php-framework-stack/issues/2