Is there any simple/correct way to disable Xdebug in a Primary Vagrant box?
I tried setting the xdebug PHP.ini vars in the /manifests/custom/php.pp puppet file, with no luck. Also commenting the xdebug lines in /manifests/init.pp with no luck either.
Any other suggestion?
Find: 'xdebug.ini'
/etc/php/7.0/cli/conf.d/20-xdebug.ini
/etc/php/7.0/fpm/conf.d/20-xdebug.ini
/etc/php/mods-available/xdebug.ini
then comment with ';'
;zend_extension=xdebug.so
then restart your nginx server
sudo service nginx restart
Related
I got this error when I run vagrant up on my macOS:
The IP address configured for the host-only network is not within the
allowed ranges. Please update the address used to be within the
allowed ranges and run the command again.
Address: 192.168.10.10 Ranges: 192.168.56.0/21
The same Vagrantfile works before, but not any more.
Any idea?
I found the "issue" started to happen after VirtualBox 6.1.26.
The way to solve is creating a new file at /etc/vbox/networks.conf on your macOS with content
* 10.0.0.0/8 192.168.0.0/16
* 2001::/64
Make sure including the asterisks *. Then the issue should be gone.
Regarding the networks.conf content, it can be found at https://www.virtualbox.org/manual/ch06.html#network_hostonly
By modifying the vagrantfile as below, it works for me.
cfg.vm.network "private_network", ip:"192.168.56.10"
I just changed the ip address from "192.168.1.10" to "192.168.56.10".
(Thanks to link in #Hongbo Miao's answers. (https://www.virtualbox.org/manual/ch06.html#network_hostonly))
Changing a Vagrantfile directly is not recommended if you didn't create it.
You can use this instead
vagrant config static_ip 192.168.56.2
The ip address can be any in the range 192.168.56.2 - 192.168.63.254. Make sure to run vagrant reload after making changes.
I had the same problem on MacOs with my Laravel Homestead and I solved doing:
sudo su -
mkdir /etc/vbox/
cd /etc/vbox/
echo '* 0.0.0.0/0 ::/0' > /etc/vbox/networks.conf
chmod 644 /etc/vbox/networks.conf
Easy Solve
$ mkdir /etc/vbox/
$cd /etc/vbox/
vbox$ sudo vi networks.conf
* 10.0.0.0/8 192.168.0.0/16
* 2001::/64
These are some trouble shooting steps that i took for resolving the issue.
In the System Preferences under Security & Privacy, enabling VirtualBox / Oracle.
After the changes restart the VirtualBox
If these doesn't resolve the issue check the following in you Vagrant File.
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
os = "generic/ubuntu2004"
net_ip = "192.168.50"
As you can see the ip range given is not what vagrant is looking for. Change the net_ip value to 192.168.56 .
This will resolve the issue.
I had the same issue on macOS after a system upgrade.
In the System Preferences under Security & Privacy, enabling VirtualBox / Oracle solved it.
Please check if your Virtualbox is updated! A reinstall solved this problem.
Got the same issue solved by the following steps
sudo nano /etc/vbox/networks.conf
10.0.0.0/8 192.168.0.0/16
2001::/64
0.0.0.0/0 ::/0
sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart
I have a Homestead VM with multiple nginx sites and a couple of apache sites too, everything configured through the Homestead.yaml file (short example below):
sites:
- map: site1.local
to: /home/vagrant/site1
php: "7.1"
#type: "apache <= (commented on purpose, not an error)
- map: site2.local
to: /home/vagrant/site2
php: "7.1"
I've been working turning On and Off the type: "apache" setting so the VM starts running apache (instead of nginx) or not, depending on the site that I need to work on at the specific moment.
My Issue now is that, after upgrading Vagrant and Homestead, it always keeps starting apache by default, no matter if it is specified or not, ALWAYS!; so everytime I start the machine, I need to ssh-it and flip the server.
I even tried using the services config directive as follows, without luck:
services:
- enabled:
- "nginx"
- disabled:
- "apache2"
Any thoughts? Please help!
Versions I am using:
Vagrant 2.2.7
Homestead 10.8.0
I had a similar issue. It turned out that I needed to log in the VM through SSH, and run the following command:
sudo systemctl enable nginx.service
When you look at restart-webserver.sh in the Homestead scripts directory, you will see that it verifies whether nginx is enabled, otherwise it always tries to restart Apache.
Everytime i go to my project I get a 502 bad gateway. When I refresh, the page works.. If I click a link to another page I get 502 bad gateway again. After the refresh the page loads. What could be the problem here.
Homestead.yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: c:/Users/MyNameHere/.ssh/id_rsa.pub
keys:
- c:/Users/MyNameHere/.ssh/id_rsa
folders:
- map: c:/Users/MyNameHere/Desktop/sites
to: /home/vagrant/code
sites:
- map: spa.test
to: /home/vagrant/code/spa/public
databases:
- homestead
Got the latest version for virtualbox and vagrant.
My spa folder contains the newest version laravel.
Login to Laravel Homestead Server with PuTTY and Private Key File.
then...
cd /etc/php/7.4/mods-available
sudo nano xdebug.ini
Comment out the first line
;zend_extension=xdebug.so
xdebug.remote_enable = 0
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
xdebug.max_nesting_level = 512
Then restart PHP-FPM
sudo service php7.4-fpm restart
Had the same issue with the latest version of homestead.
After digging in log files and then github issues for homestead, I found this this.
There's an issue with xdebug that they're waiting for a fix for. The solution is to disable xdebug or use php 7.2. I opted for the latter. In that case, make the following change in your homestead.yaml and then running vagrant reload --provision will fix this.
sites:
- map: spa.test
to: /home/vagrant/code/spa/public
php: "7.2"
I was having the same problem and I couldn't change the PHP version or disable xdebug, but I could and did change for the Apache server.
sites:
- map: spa.test
to: /home/vagrant/code/spa/public
type: "apache"
I had a similar issue, got the 502 error. Refreshing the browser or reloading the virtual machine had no effect.
I solved disabling the Xdebug. Found the solution here: https://christattum.com/disabling-xdebug-in-laravel-homestead/
On prompt:
cd /etc/php/7.4/mods-available
sudo vi xdebug.ini
Commented all the lines of the file with ;
Run the vagrant reload --provision command to the Homestead file in the virtual machine, and then after vagrant up, enter with vagrant ssh. Your problem will be solved :)
You can change your ip post adress and write 127.0.0.1 in your host file.
You can enter it by adding 8000 next to the project name in the search engine.
For example spa.test:8000 and then running vagrant reload --provision will fix this.
I lost 3 days trying to solve the same issue.
My mistake was to have defined in my host file something like:
127.0.0.1 spa.test
The solution is to add instead, the same IP you specified in Homestead.yaml.
192.168.10.10 spa.test
to /etc/host (In case of Mac)
to C:\Windows\System32\drivers\etc\hosts (in case of Windows)
Even if you have multiple hosts defined in your global Homestead.yaml file.
For instance
folders:
- map: /Users/davidecasiraghi/Projects/my_laravel_project
to: /home/vagrant/code/my_laravel_project
- map: /Users/davidecasiraghi/Projects/spa
to: /home/vagrant/code/spa
sites:
- map: my_laravel_project.test
to: /home/vagrant/code/my_laravel_project/public
- map: spa.test
to: /home/vagrant/code/spa/public
Then in the host file:
192.168.10.10 spa.test
192.168.10.10 my_laravel_project.test
Then when you will do vagrant up you will be able to access to both of them.
For me this was related to Xdebug, which doesn't seem to yet be compatible with PHP 7.3.
To continue using 7.3, you can turn Xdebug off with
sudo phpdismod xdebug
restart php service
sudo service php7.3-fpm reload
For Chinese,
if you are using Clash for Windows,
then edit "Bypass Domain".
It's not relevant to this question,
but Google lead me here,
Do this inside your Homestead VM vagrant ssh
Check your php version
$ php -v
Edit your website config file
$ sudo nano /etc/nginx/sites-available/<laravel.app>
line
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
change according to your php version
mine was php8.2-fpm.sock; then I change it to php8.1-fpm.sock; press ctrl+x to save, then
$ sudo service nginx restart
$ sudo service php<ver>-fpm restart
reload the page
I'm running Laravel/Homestead as my Vagrant box and have heard that Nginx has some weird caching issues. The way to solve the problem is to set "sendfille off" in the nginx config file.
How can I provision my Laravel/Homestead Vagrant box so that I don't have to ssh into the box and modify the setting?
In your host's homestead folder you can find homestead/scripts/serve.sh. There sendfile is already set to off as default for your app. I think this will set nginx sendfile option to off.
If you still want to edit the nginx.conf permanently, write a line of code into serve.sh to change the config file.
More info on serve.sh
The serve.sh script will run on --provision for any site configured in the Homestead.yaml.
It creates each site in /etc/nginx/sites-available/ and symlinks it to /etc/nginx/sites-enabled/. Nginx and php5-fpm get restarted after that.
In nginx.conf we can see at the end of the http{...}-block has:
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
This includes all sites in /etc/nginx/sites-available/ where the server{...}-blocks are defined. For more information about nginx config look at the Nginx Admin Guide.
I set it up a vagrant machine with https://puphpet.com/#.
Everything was OK until I wanted to change the documentroot for an apache vhost:docroot in config.yaml
This change is not reloaded although I run :
vagrant --provision reload
Just run $ vagrant provision, no need to reload.