Problems while running `vagrant up` command in GIT Bash - php

I'm new in PHP and MySQL programming, I have VirtualBox to create a web server on my PC for free with Homestead Improved, I found the instructions on a book. I cloned Homestead on my PC and in the same directory I tried to run vagrant up. Unfortunately, I got this error:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["import", "\\\\?\\C:\\Users\\simon\\.vagrant.d\\boxes\\laravel-VAGRANTSLASH-homestead\\11.5.0\\virtualbox\\box.ovf", "--vsys", "0", "--vmname", "ubuntu-20.04-amd64_1638456664386_25621", "--vsys", "0", "--unit", "11", "--disk", "C:/Users/simon/Desktop/VirtualBox VMs/ubuntu-20.04-amd64_1638456664386_25621/ubuntu-20.04-amd64-disk001.vmdk"]
Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting \\?\C:\Users\simon\.vagrant.d\boxes\laravel-VAGRANTSLASH-homestead\11.5.0\virtualbox\box.ovf...
OK.
0%...
Progress state: E_INVALIDARG
VBoxManage.exe: error: Appliance import failed
VBoxManage.exe: error: Code E_INVALIDARG (0x80070057) - One or more arguments are invalid (extended info not available)
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)" at line 1119 of file VBoxManageAppliance.cpp
Can someone help me please? I'm going crazy.

Related

Error in setting up Laravel sail with docker

Working on setup for a php class, and I keep running into an error when trying to setup the example windows laravel app from the docs (https://laravel.com/docs/9.x/installation#getting-started-on-windows). After entering:
curl -s https://laravel.build/example-app | bash
I get the following error:
Processing fstab with mount -a failed.
<3>WSL (17) ERROR: CreateProcessEntryCommon:358: getpwuid(0) failed 2
<3>WSL (17) ERROR: CreateProcessEntryCommon:362: getpwuid(0) failed 2
<3>WSL (17) ERROR: CreateProcessEntryCommon:570: execvpe /bin/bash failed 2
<3>WSL (17) ERROR: CreateProcessEntryCommon:579: Create process not expected to return
As far as I know, I have docker and wsl2 installed correctly so I am unsure as to what is causing this error. I have Ubuntu installed as well, but unless I misunderstood the docs, I should just be able to punch the curl straight into cmd prompt to build it in the desired directory.

Cakephp 3.4.14 Exception: Shell class for "Serve" could not be found

here is my shell snip
Maan#DESKTOP-TNA7PJU MINGW64 /d/xampp1/htdocs/app
$ bin/cake serve
Exception: Shell class for "Serve" could not be found. in [D:\xampp1\htdocs\app\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php, line 327]
Maan#DESKTOP-TNA7PJU MINGW64 /d/xampp1/htdocs/app
$ cd ../pocketpa-git-clone000000/
Maan#DESKTOP-TNA7PJU MINGW64 /d/xampp1/htdocs/pocketpa-git-clone000000 (master)
$ bin/cake serve
Exception: Shell class for "Serve" could not be found. in [D:\xampp1\htdocs\pocketpa-git-clone000000\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php, line 327]
Warning Error: file_put_contents(D:\xampp1\htdocs\pocketpa-git-clone000000\logs\cli-error.log): failed to open stream: No such file or directory in [D:\xampp1\htdocs\pocketpa-git-clone000000\vendor\cakephp\cakephp\src\Log\Engine\FileLog.php, line 133]
PHP Warning: file_put_contents(D:\xampp1\htdocs\pocketpa-git-clone000000\logs\cli-error.log): failed to open stream: No such file or directory in D:\xampp1\htdocs\pocketpa-git-clone000000\vendor\cakephp\cakephp\src\Log\Engine\FileLog.php on line 133
last night i shut down my pc and in morning when i restart i am facing this issue
cakephp version 3.4.14
php 5.6.36
and having this problem when wants to start project
Sorry my bad i was messed up with diffferent projects i was working on Laravel Projects and using frequently
php artisan serve
This command will start a development server at http://localhost:8000:
when i come back to CakePhp Project i was messed up and trying
bin\cake serve
command to start local server for cakephp environment http://localhost:8765/
thats make me so much trouble
But the orignal command to run CakePhp Sever on LocalHost is
bin\cake server
here you can get more details https://book.cakephp.org/3.0/en/installation.html#development-server

Nginx + php-fpm: Bad gateway only when xdebug server is running

Problem
When xdebug server is running from IntelliJ IDEA, I get 502 Bad Gateway from nginx when I try loading my site to trigger breakpoints.
If I stop the xdebug server, the site works as intended.
So, I'm not able to run the debugger, but it did work previously (!). Not able to pinpoint why it suddenly stopped working.
Setup
A short explanation of the setup (let me know if I need to expand on this).
My php app is running in a docker container, and it is linked to nginx running in a different container using volumes_fromin the docker compose config.
After starting the app, I can verify using phpinfo(); the xdebug module is loaded.
My xdebug.ini has the following content:
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=10.0.2.2
xdebug.remote_connect_back=0
xdebug.remote_port=5555
xdebug.idekey=complex
xdebug.remote_handler=dbgp
xdebug.remote_log=/var/log/xdebug.log
xdebug.remote_autostart=1
I got the ip address for remote_host (where the xdebug server is running) by these steps:
docker-machine ssh default
route -n | awk '/UG[ \t]/{print $2}' <-- Returns 10.0.2.2
To verify I could reach the debugging server from within my php container, I did the following steps
docker exec -it randomhash bash
nc -z -v 10.0.2.2 5555
Giving the following output depending on xdebug server running or not:
Running: Connection to 10.0.2.2 5555 port [tcp/*] succeeded!
Not running: nc: connect to 10.0.2.2 port 5555 (tcp) failed: Connection refused
So IntelliJ IDEA is surely set up to receive connections on 5555. I also did the appropriate path mapping between my source file paths and the remote path (when setting up the PHP Remote Debugging server from within IDEA).
Any ideas? Kind of lost on this one as I don't have much experience with any of these technologies :D
This sometimes happens, the reason is the errors in php-fpm and xdebug (exactly)!
When I refactored my colleagues code, оne page on the project returned 502 Bad Gateway
Here's what I found:
php-fpm.log
WARNING: [pool www] child 158 said into stderr: "*** Error in `php-fpm: pool www': free(): invalid size: 0x00007f1351b7d2a0 ***"
........
........
WARNING: [pool www] child 158 exited on signal 6 (SIGABRT - core dumped) after 38.407847 seconds from start
I found a piece of code that caused the error:
ob_start();
$result = eval("?>".$string."<"."?p"."hp return 1;");
$new_string = ob_get_clean();
But that is not all. The error occurred only in a certain state $string which at first glance, did not differ from the others. In my case, everything is simple. I removed the code that caused the error. This did not affect the functionality of the web page. I continued to debug the code further.
I had the same problem with the Vagrant Homestead Parallels box with a Silicon chip. Switching from php 7.3 to 7.4 fixed the issue for me.

PHPUnit Selenium Xvfb Centos

I am trying to setup functional tests on my Centos Server using Selenium Web Server and Phpunit.
When I run the tests, I get an error in the command line :
PHPUnit_Extensions_Selenium2TestCase_WebDriverException:
Unable to connect to host vmdev-pando-56 on port 7055 after 45000 ms.
Firefox console output: Error: no display specified
I've been doing research for more than three days and I couldn't find a solution. I read many posts, including SOverflow. As per my understanding, everything is properly set up, and yet I am experiencing the same problem as many other people, and the solutions that work for them seem to be not working for me.
This is my setup:
OS: Centos 6.5 x86 in command line (no GUI)
PHP: 5.6
Phpunit: 3.7, although I also tried with 5.3
Selenium standalone web server: 2.53, downloaded from here, although I also tried with 2.9
Xvfb system: xorg-x11-server-Xvfb
Firefox: 38.0.1, although I also tried with 38.7
I also set the DISPLAY to :99 in my bash profile:
This is what I do to set up the environment:
First, I launch the Xvfb system: /usr/bin/Xvfb :99 -ac -screen 0 1280x1024x24 &
Then I launch the Selenium server: /usr/bin/java -jar /usr/lib/selenium/selenium-server-standalone-2.53.0.jar &
I launch Firefox: firefox & (although I know this is not necessary, but just in case)
All of the three processes are running in background.
At this point, I know that Firefox is operative, as well as the X buffer. I can run the command firefox http://www.stackoverflow.com & and then take an snapshot of the buffer by executing import -window root /tmp/buffer_snapshot.png, which happens to be something like this:
I of course received a warning on the terminal: Xlib: extension "RANDR" missing on display ":99", but I read countless of times that this is not a problem.
Anyway, the problem begins just now.
I've written a rather simple functional test (please notice that other tests I've written other than functional, they work just fine, so the environment in that respect seem to be properly configured):
<?php
namespace My\APP\BUNDLE\Tests\Functional\MyTest;
use PHPUnit_Extensions_Selenium2TestCase;
class HelloWorldTest extends PHPUnit_Extensions_Selenium2TestCase {
protected function setUp() {
$this->setBrowser('firefox');
$this->setHost('localhost');
$this->setPort(4444);
$this->setBrowserUrl('http://www.stackoverflow.com');
}
public function testTitle() {
$this->url('/');
$this->assertEquals("1", "1");
}
}
And when I run the test by issuing phpunit HelloWorldTest.php, I get the following error:
PHPUnit_Extensions_Selenium2TestCase_WebDriverException:
Unable to connect to host vmdev-pando-56 on port 7055
after 45000 ms. Firefox console output:
Error: no display specified
Checking the log file generated by selenium, I found the following (interesting) lines:
21:55:46.135 INFO - Creating a new session for Capabilities [{browserName=firefox}]
[...]
java.util.concurrent.ExecutionException:
org.openqa.selenium.WebDriverException:
java.lang.reflect.InvocationTargetException
Build info: version: '2.53.0',
revision: '35ae25b',
time: '2016-03-15 17:00:58'
System info: host: 'vmdev-pando-56',
ip: '127.0.0.1',
os.name: 'Linux',
os.arch: 'i386',
os.version: '2.6.32-431.el6.i686',
java.version: '1.7.0_99'
Driver info: driver.version: unknown
[...]
(The file contains the complete stack trace dump, and the original message of no display specified)
No errors in the Xvfb log file.
At this point I have no clue of what I am doing wrong.
Can anyone help?
Thanks a lot
A reason for the Unable to connect error is that the version of Selenium Server does not know how to work with the version of Firefox you have installed. Selenium standalone web server 2.53 is the latest and greatest. selenium-firefox-driver is also 2.53. Firefox version 38 is old. I am running firefox 45.0.1 with selenium 2.53.

Laravel Homestead error: Failed to create host-only adaptor

This error occurs with all Vagrant boxes with a private network IP.
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["hostonlyif", "create"]
Stderr: 0%...
Progress state: E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available)
VBoxManage.exe: error: Context: "int __cdecl handleCreate(struct HandlerArg *,int,int *)" at line 66 of file VBoxManageHostonly.cpp
I've tried composer install, manual install, downgrading virtualbox to 4.2.x - nothing works.
Please help!
Thanks
Turns out to be a common 'issue' on Windows 7 hosts with any vagrant box with a private network.
The Windows host user account needs to have admin rights.
There's a known bug # 14040 in VirtualBox 5. Updating to Vbox 5.0.9 worked for me.
I had the same problem using virtualbox 5.0.26 when I updated to 5.1.4 it worked! am using vagrant version 1.9.1

Categories