I have followed to the letter instructions for setting up xdebug with Visual Studio Code: https://blogs.msdn.microsoft.com/nicktrog/2016/02/11/configuring-visual-studio-code-for-php-development/
So all config files, files, etc are installed and tested as working outside of PHP.
Currently I am running PHP using the built in server (php -S localhost:8000 -t).
This works fine and I can see output in my browser. Similarly within VS Code I can run my code fine by running Ctrl + Shift + B. It also works inside Eclipse after installing PDT plugin.
Using phpinfo() I can see that xdebug is there and working fine. However, when I 'listen for XDebug' (I have changed launch.json to use port 8000) or press F5 all that happens is my status bar turns orange, the debug pane shows nothing and the debug buttons show pause/stop and I have to click one of these to quit the program, i.e. it does nothing.
What am I doing wrong?
Keep in mind that if you running PHP using the built in server, you must configure the php.ini file of the CLI (in my case is sudo nano /etc/php/5.6/cli/php.ini), not of Apache 2.
You shouldn't change launch.json to use port 8000, unless you've set xdebug.remote_port=8000 in your php.ini file. The port of the php server and xdebug are two different things. I guess that your xdebugremote_port is 9000 since using port 8000 for both things is impossible, so just change launch.json back to 9000.
I'm using WAMP. In the past weeks I struggled a lot to make php and curl work behind a corporate proxy, finally I did it: Apache behind corporate proxy
The problem is that now I can't make them work at home! (of course initially they were working at home without proxy). When I run a CURL command from php I get the following error: Curl error: Failed to connect to localhost port 3128
I removed all the environment variable https_proxy and http_proxy, on apache I removed the "proxy_module", on IE I removed the proxy, now when I run the following command there are no results:
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | find /i "proxyserver"
It seems that CURL is taking the proxy configuration from somewhere in the environment variable, in fact if I add the applicative code:
curl_setopt($ch,CURLOPT_PROXY, '');
then everything is working fine (but I don't want to change the applicative code). Where else can I look for the proxy confing?
Thanks very much
I cannot debug Laravel via PhpStorm and Xdebug.
When I try to debug a single file via PhpStorm, it works fine, but when I set a breakpoint and try it on the browser, it doesn't work.
PhpStorm waits for incoming connection with ide key and it stops there.
The workflow that I've set:
Use something like Xdebug helper.
Configure it to use PhpStorm IDE Key.
When you want to debug:
Activate Xdebug Helper (Mark Debug)
Go to PhpStorm and Run > Start listening for PHP Debug Connections
Put a breakpoint at your code
Refresh your page in Chrome (or go to another one, just make a request).
Basically, the Xdebug Helper will be your trigger. If you disable it, PhpStorm no longer will debug your code.
If you don't want to relay on an extension, you can go to your Xdebug config and set:
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=1
And "Start listening for PHP Debug Connections" will be your trigger.
sorry I'm really new to vagrant I am running vagrant 1.4.3 and virtualbox 4.3.26. and my host OS is ubuntu 14.04.2.
I am a php developer and I'm trying to make my development environment ready for couple of projects.
and every box I try from vagrantbox.es I get the same error when running vagrant up command.
and the error is :
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period. This can
mean a number of things.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
I've looked through same questions and I tried
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
after adding these lines I get login page in my box so its booting and I can run my commands in the GUI interface.
but surprisingly I get same error. I thought with myself maybe its because the guest OS couldn't login and I add these lines to my vagrant file
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
config.ssh.insert_key = "true"
but I get this error
There are errors in the configuration of this machine. Please fix
the following errors and try again:
SSH:
* The following settings shouldn't exist: insert_key, password
and actually I'm screwed and I don't know what else should I do .
go to in virtual box and stop the run connection. click on start and wait for login with user and pass: vagrant. inside of that write this command:
sudo vim /etc/systemd/system/network-online.targets.wants/networking.service
And changing the following line at the end of the file:
TimeoutStartSec=5min
to:
TimeoutStartSec=30sec
I have then rebooted the system and it works fine.
I upgraded my vagrant to 1.7.2 and my problem is solved now. but I don't see my box running in virtualbox interface . after all I can now ssh to my box and there is no problem.
I use composer on a network where the only way to access the internet is using HTTP or socks proxy. I have http_proxy and https_proxy environment variables. When compose tries to access HTTPS URLs I get this:
file could not be downloaded: failed to open stream: Cannot connect to HTTPS server through proxy
As far as I know the only way to connect to a https website is using a connect verb. How can I use composer behind this proxy?
If you are using Windows, you should set the same environment variables, but Windows style:
set http_proxy=<your_http_proxy:proxy_port>
set https_proxy=<your_https_proxy:proxy_port>
That will work for your current cmd.exe. If you want to do this more permanent, y suggest you to use environment variables on your system.
If you're on Linux or Unix (including OS X), you should put this somewhere that will affect your environment:
export HTTP_PROXY_REQUEST_FULLURI=0 # or false
export HTTPS_PROXY_REQUEST_FULLURI=0 #
You can put it in /etc/profile to globally affect all users on the machine, or your own ~/.bashrc or ~/.zshrc, depending on which shell you use.
If you're on Windows, open the Environment Variables control panel, and add either a system or user environment variables with both HTTP_PROXY_REQUEST_FULLURI and HTTPS_PROXY_REQUEST_FULLURI set to 0 or false.
For other people reading this (not you, since you said you have these set up), make sure HTTP_PROXY and HTTPS_PROXY are set to the correct proxy, using the same methods. If you're on Unix/Linux/OS X, setting both upper and lowercase versions of the variable name is the most complete approach, as some things use only the lowercase version, and IIRC some use the upper case. (I'm often using a sort of hybrid environment, Cygwin on Windows, and I know for me it was important to have both, but pure Unix/Linux environments might be able to get away with just lowercase.)
If you still can't get things working after you've done all this, and you're sure you have the correct proxy address set, then look into whether your company is using a Microsoft proxy server. If so, you probably need to install Cntlm as a child proxy to connect between Composer (etc.) and the Microsoft proxy server. Google CNTLM for more information and directions on how to set it up.
If you have to use credentials try this:
export HTTP_PROXY="http://username:password#webproxy.com:port"
Try this:
export HTTPS_PROXY_REQUEST_FULLURI=false
solved this issue for me working behind a proxy at a company few weeks ago.
This works , this is my case ...
C:\xampp\htdocs\your_dir>SET HTTP_PROXY="http://192.168.1.103:8080"
Replace with your IP and Port
on Windows insert:
set http_proxy=<proxy>
set https_proxy=<proxy>
before
php "%~dp0composer.phar" %*
or on Linux insert:
export http_proxy=<proxy>
export https_proxy=<proxy>
before
php "${dir}/composer.phar" "$#"
iconoclast's answer did not work for me.
I upgraded my php from 5.3.* (xampp 1.7.4) to 5.5.* (xampp 1.8.3) and the problem was solved.
Try iconoclast's answer first, if it doesn't work then upgrading might solve the problem.
You can use the standard HTTP_PROXY environment var. Simply set it to the URL of your proxy. Many operating systems already set this variable for you.
Just export the variable, then you don't have to type it all the time.
export HTTP_PROXY="http://johndoeproxy.cu:8080"
Then you can do composer update normally.
Operation timed out (IPv6 issues)#
You may run into errors if IPv6 is not configured correctly. A common error is:
The "https://getcomposer.org/version" file could not be downloaded: failed to
open stream: Operation timed out
We recommend you fix your IPv6 setup. If that is not possible, you can try the following workarounds:
Workaround Linux:
On linux, it seems that running this command helps to make ipv4 traffic have a higher prio than ipv6, which is a better alternative than disabling ipv6 entirely:
sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"
Workaround Windows:
On windows the only way is to disable ipv6 entirely I am afraid (either in windows or in your home router).
Workaround Mac OS X:
Get name of your network device:
networksetup -listallnetworkservices
Disable IPv6 on that device (in this case "Wi-Fi"):
networksetup -setv6off Wi-Fi
Run composer ...
You can enable IPv6 again with:
networksetup -setv6automatic Wi-Fi
That said, if this fixes your problem, please talk to your ISP about it to try and resolve the routing errors. That's the best way to get things resolved for everyone.
Hoping it will help you!
according to above ideas, I created a shell script that to make a proxy environment for composer.
#!/bin/bash
export HTTP_PROXY=http://127.0.0.1:8888/
export HTTPS_PROXY=http://127.0.0.1:8888/
zsh # you can alse use bash or other shell
This piece of code is in a file named ~/bin/proxy_mode_shell and it will create a new zsh shell instance when you need proxy. After update finished, you can simply press key Ctrl+D to quit the proxy mode.
add export PATH=~/bin:$PATH to ~/.bashrc or ~/.zshrc if you cannot run proxy_mode_shell directly.