0

I'm having some problems with installing my app on vps server with ssh2_connection. I have created library to configure and automatically install laravel project on any vps (apache, mariadb, mysql, php, phpmyadmin..), but now I have one last problem, running php artisan like cd /var/www && php arisan key:generate, and every time it says like:

Could not open input file: arisan

Ofcourse when I open console in putty it will work, but with php function I had no success. My function looks like:

public static function installLaravel($connection){
        $cmds = array (
            'cd /var/www && php arisan migrate',
            'cd /var/www && php arisan db:seed',
            'cd /var/www && php arisan passport:install',
        );

        foreach ($cmds as $cmd) {
            $stream = ssh2_exec($connection, $cmd);
            stream_set_blocking($stream, true);
            $stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
            echo stream_get_contents($stream_out);
            echo stream_get_contents($stream);
        }
    }

I tried to add cd ~/var/www or cd /var/www before running php artisan commands, but it will always set route to root directory.

I even tried to run like php /var/www/sitea/artisan migrate still same problem

BTW: I'm testing on Centos 8

Any suggestions?

1 Answer 1

1

It's called artisan (you're missing a t), not arisan.

$cmds = array (
    'cd /var/www && php artisan migrate',
    'cd /var/www && php artisan db:seed',
    'cd /var/www && php artisan passport:install',
);
Sign up to request clarification or add additional context in comments.

3 Comments

OMG I can't believe I lost last hour wondering what is the problem. Probably 12h programing today is enough. Thank you! :)
You're welcome :). Consider marking my answer as the accepted answer.
also shorten your code. php /var/www/artisan migrate

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.