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?