Reputation: 1510
I've deployed my Symfony 2.1 application on openshift and it doesn't work.
Calling app.php
server return 200 OK
and a white page (in my local server work well).
Log:
=> php-5.3/logs/error_log-20130306-000000-EST <== [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 3. require_once() /var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/app/bootstrap.php.cache:4 [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 4. require() /var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/app/autoload.php:5 [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 5. ComposerAutoloaderInit12cecca862685bdd480babbdd1b1ec7a::getLoader() /var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/vendor/autoload.php:7 [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP Fatal error: require(): Failed opening required '/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/vendor/kriswallsmith/assetic/src/functions.php' (include_path='.:/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo//libs/:/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/php-5.3/phplib/pear/pear/php/:/usr/share/pear/') in /var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/vendor/composer/autoload_real.php on line 42 [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP Stack trace: [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 1. {main}() /var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/web/app.php:0 [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 2. require_once() /var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/web/app.php:7 [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 3. require_once() /var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/app/bootstrap.php.cache:4 [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 4. require() /var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/app/autoload.php:5 [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 5. ComposerAutoloaderInit12cecca862685bdd480babbdd1b1ec7a::getLoader() /var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/vendor/autoload.php:7
Any idea or suggestion?
Upvotes: 1
Views: 792
Reputation: 121
The best way to deploy a Symfony app to Openshift is:
release
: rhc app-configure --deployment-branch release -a <app-name>
<?php
# app/config/params.php
if (getEnv("OPENSHIFT_APP_NAME")!='') {
$container->setParameter('database_host', getEnv("OPENSHIFT_MYSQL_DB_HOST"));
$container->setParameter('database_port', getEnv("OPENSHIFT_MYSQL_DB_PORT"));
$container->setParameter('database_name', getEnv("OPENSHIFT_APP_NAME"));
$container->setParameter('database_user', getEnv("OPENSHIFT_MYSQL_DB_USERNAME"));
$container->setParameter('database_password', getEnv("OPENSHIFT_MYSQL_DB_PASSWORD"));
}?>
This will tell the app that if is openshift environment it needs to load different user an database
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: params.php }
...
git checkout -b release
git remote add openshift -f <youropenshiftrepository.git>
git merge openshift/master -s recursive -X ours
#!/bin/bash
# Symfony deploy
export COMPOSER_HOME="$OPENSHIFT_DATA_DIR/.composer"
if [ ! -f "$OPENSHIFT_DATA_DIR/composer.phar" ]; then
curl -s https://getcomposer.org/installer | php -- --install-dir=$OPENSHIFT_DATA_DIR
else
php $OPENSHIFT_DATA_DIR/composer.phar self-update
fi
unset GIT_DIR
cd $OPENSHIFT_REPO_DIR/
php $OPENSHIFT_DATA_DIR/composer.phar install
php $OPENSHIFT_REPO_DIR/app/console cache:clear --env=dev
chmod -R 0777 $OPENSHIFT_REPO_DIR/app/cache
chmod -R 0777 $OPENSHIFT_REPO_DIR/app/logs
rm -r $OPENSHIFT_REPO_DIR/php
ln -s $OPENSHIFT_REPO_DIR/web $OPENSHIFT_REPO_DIR/php
rm -r $OPENSHIFT_REPO_DIR/php
ln -s $OPENSHIFT_REPO_DIR/web $OPENSHIFT_REPO_DIR/php
php $OPENSHIFT_REPO_DIR/app/console doctrine:schema:update --force
git update-index --chmod=+x .openshift/action_hooks/deploy
In Linux and Mac: chmod +x .openshift/action_hooks/deploy
git push openshift HEAD
git checkout master
release
branch to deploy your new changes: git checkout release
git merge master
git push openshift HEAD
git checkout master
And that's how I work with Symfony and Openshift. (These instructions are a mix from many ways I read and I imporved with some changes. It works very well for every app I've made.
Upvotes: 1
Reputation: 5306
You have not "warm-up" your cache since the bootstrap.php.cache
file isn't there, it seems like you just push your repo and do nothing yet on the openshift side.
You'll need to configure your symphony app first, that is download all the dependencies, fill in all the database settings, mailer settings and all other stuff.
ssh into your gear using this command rhc ssh -a <yourappname>
, cd into your symfony root directory, and run php composer.phar install
this will start everything that is needed to deploy your app completely
Upvotes: 1
Reputation: 27736
Seems like you're missing some of the files in your gear repository. Did you add-commit-push all of your files?
You can get list of the deployed *.php files by running:
ssh <INTO-YOUR-GEAR> 'cd ~/app-root/runtime/repo/php && find ./ -name \*.php'
(obviously you need to substitute <INTO-YOUR-GEAR>
with your SSH string)
Upvotes: 1