jeudi 1 mars 2018

How to tell Deployer to use different PHP version once ssh'ed to my shared hosting?

I'm experimenting with Deployer to deploy Laravel application into shared hosting (using laravel recipe) from my local ~/Code/project_foo.

The point is that when I'm connected to my shared hosting server via ssh, then default php -v version is 5.6.33. I confirmed that I can change php version on fly by calling php70 -v or even whole path like /usr/local/bin/php70 whatever.

The point is that I don't know how to tell deployer to call commands using php70 which is required, otherwise composer install fails.

enter image description here

So in Terminal I'm inside root of the Laravel project and I simply call:

dep deploy

My deploy.php is messy and very simple but this is just a proof of concept. I'm trying to figure out everything and then I will male it look nicer.

enter image description here

I checked the source code of the laravel recipe, and I saw that there is:

but I don't know how to override the value to match what my hosting tells me to use:

/usr/local/bin/php70

Please, give me any hints how to force the script use different PHP version once connected to the remote host / server.

This is whole script:

<?php
namespace Deployer;

require 'recipe/laravel.php';


//env('bin/php', '/usr/local/bin/php70'); // <- I thought that this will work but it doesn't change anything


// Project name
set('application', 'my_project');

// Project repository
set('repository', 'git@github.com:xxx/xxx.git');

// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true); 

// Shared files/dirs between deploys 
add('shared_files', []);
add('shared_dirs', []);

// Writable dirs by web server 
add('writable_dirs', []);


// Hosts

host('xxx')
    ->user('xxx')
    ->set('deploy_path', '/home/slickpl/projects/xxx');

// Tasks

task('build', function () {
    run('cd  && build');
});

// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');

// Migrate database before symlink new release.

before('deploy:symlink', 'artisan:migrate');



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2Fhi1X8
via IFTTT

Aucun commentaire:

Enregistrer un commentaire