cannot run commands in tinkerwell over ssh connection (laravel) - laravel

Tinker works just fine when I am ssh'd into my box, but I cannot get it to work in tinkerwell.
I'm trying to connect to my local vagrant box with tinkerwell. It is a vagrant box running in windows: ubuntu 20, laravel 5.7, php7.3.33. Tinkerwell 2.25 in Windows 10. I can connect over ssh, but it errors out whenever I run any command:
In Shell.php line 79:
Argument 1 passed to _PhpScoperc223a629f245\Psy\Shell::add() must be
an ins tance of
_PhpScoperc223a629f245\Symfony\Component\Console\Command\Command, instance of Psy\Command\ParseCommand given, called in
phar:///tmp/vagrant_t
inker.phar/vendor/symfony/console/Application.php on line 316
I get the same error whenever I try to run any command. On google I found a thread where someone had the same issue, except they were not connecting over ssh, they were on a mac, and the thread had no resolution in it (https://github.com/beyondcode/tinkerwell-community/issues/215).
I have checked that the correct version of php is in my $PATH, so the default path of php for the php executable that tinkerwell picks seems correct. I have also tried specifying /usr/bin/php but it doesn't change anything.

Related

Homestead server times out when route not found

Accessing any invalid/non existing route on fresh laravel app returns halts & timeout after 60 seconds.
Error: The process "git status -s" exceeded the timeout of 60 seconds.
Same code works fine fine locally on xampp and returns method/controller not found within a couple of seconds. Please guide.
P.S: Seems like git status takes a lot of time inside vagrant ssh, but it works fine on host machine. What also bothers me is why git status command is being run when accessing route?
Host: Windows 10
Box: v9.2.0.
Virtualbox v6.1.2
Vagrant: v2.2.6
Ok, so turns out the laravel error page package ignition is causing all the problems.
There is an ongoing issue on there github page and multiple solution including the git status issue.

Can start ChromeDriver within CLI tool but won't allow connections

I'm using Laravel homestead and I'm writing a little artisan command line tool that I need to browse my site with javascript execution.
I run dusk test regularly with no difficulty, so I thought I would use Laravel's tools for this script.
I started out by running this early in my script:
\Laravel\Dusk\TestCase::startChromeDriver();
This started the driver fine running on port 9515 running as user vagrant (default homestead user)
But when I tried to access it (also from within the script) I would get an error:
Failed to connect to localhost port 9515: Connection refused
If I instead started it manually on the command line:
$ ./vendor/laravel/dusk/bin/chromedriver-linux --port=9515
The driver started fine again running on port 9515 as user vagrant, but this time my tool runs fine.
But I really want to be able to start the ChromeDriver from within the tool. So I also tried:
$process = new \Symfony\Component\Process\Process('./vendor/laravel/dusk/bin/chromedriver-linux --port=9515');
$process->start();
Connection was refused again.
Any idea why this works when I start it from the command line but not within my artisan command?
I can't explain why this makes a difference but it has. If I launch the driver with the full path:
/home/vagrant/Code/mysite/vendor/laravel/dusk/bin/chromedriver-linux --port=8888
all works fine now.

running sonarqube 6.7.1 on Ubuntu Server 16.04 using provided deb-files fails

I'm unable to get the latest Sonarqube up and running on Ubuntu 16.04.
Installation was done using the deb provided by http://sonar-pkg.sourceforge.net
After a first cursory glance it seems that the installation routine sets up Sonarqube to run as user "root", whereas Elastisearch - which is mandatory - refuses to be started as "root".
Has anybody been able to set this up properly (i.e. running as a non-root user) and can point me to the respective documentation?
Thanks.
First, navigate to the install folder > ex: /opt/sonarqube-6.7.1/bin/linux-x86-64.
Then open the sonar.sh file in that folder using vim, nano commands etc.
Then uncomment the line which reads "RUN_AS_USER=" which is around line number 48.
change the line to "RUN_AS_USER=sonar"
restart your system, start the sonarqube server. You should be able to run your server.

unable to access magento classes via command line interface/vagrant box

i installed Magento via a vagrant box. it works fine.
However, i need to test code via CLI .i accordingly created a page at the root of the site with following code:
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
$customer = Mage::getModel('customer/customer')->load(79);
print_r($customer->getData());
i then tried to access this page via command line interface on windows (cygwin) with following commands
php magento/test.php
i get the following errors;
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [20 02] No connection could be made because the target machine actively refused it.
' in C:\DevFolder\magentoKlierik\magento\lib\Zend\Db\Adapter\Pdo\Abstract.php:12 9
however when i make the same call via the URL i get access. i.e
why is there a difference when using command line and how do i give permission on the command line
You have to run the code inside the vagrant box, so in this case you need to run in your host system:
vagrant ssh -c 'php /vagrant/httpdocs/test.php'
For more information you can refer to the documentation.
Moreover I suggest you not to use custom scripts but use the system that is provided by magento for creating cli scripts.
You can find a good tutorial on inchoo (which I did not write) that provides you with some examples.

Running dusk tests on Homestead for Windows

I'm using homestead on windows 10 and installed laravel 5.4 when I'm trying to run dusk tests I get the following error:
1) Tests\Feature\ViewProductListingTest::user_can_view_product_listing
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY"}}
Failed to connect to localhost port 9515: Connection refused
Has anybody had any luck getting around this?
Thanx.
I encountered this very problem today. I spent like 2 hours researching and finally resolved it by following the steps posted on this comment.
I ran the original basic test and it passed. I'll try to run more complex test and hopefully the solution still works.
It seems to me that the Homestead lacks some necessary software(Chrome, xvfb etc.) to run browser tests with Laravel Dusk. That's what that comment is trying to install.
Hope this helps!
I ran into this issue before and was not able to completely resolve it.
The connection refused error occured for me because the execution scripts for dusk in /vendor/laravel/dusk/bin were not set executable inside Homestead.
So i used a chmod 777 on those scripts.
After that it complained that if couldn't find an executable chrome binary, so i installed google-chrome in Homestead.
After I installed google chrome, the tests ran, but timed out before they could finish which i am researching now.
I ran into the same issue (but I'm on macOS Sierra). If you can, instead of running Dusk from the Homestead VM, run it from your host machine. Just make sure the DB_HOST value in your .env file is set to the hostname you use to access the site in your browser.
So for example, if you configured the Homestead site to be accessible at mycoolsite.app, use that as your DB_HOST value.
I know this is more of a workaround for situations where your host machine might be able to run it OK, but it's working for me at the moment if you can give it a try.

Resources