I have a Homestead vagrant VM setup. Xdebug is all setup for remote debugging out of the box.
I can see this in here /etc/php5/fpm/conf.d/20-xdebug.ini
and by doing a php -i | grep 'xdebug'
I've setup a breakpoint in my default index.php and clicked the 'start listening for PHP debug connections' in my IDE PHPstorm.
I have installed xdebug helper for chrome and turned it on, also setting my IDE string to PHPstorm in it's settings.
I've tried setting different ports in both my IDE and xdebug settings.
I've also tried listening to these ports with sudo nc -l 9002
on both host and guest machines, nothing connects so the problem here is definitely with xdebug settings in the PHP server.
Posting my own answer here for posterity in the hope it saves someone time as I trawled google for an answer and spent several hours stuck on this.
When doing a sudo netstat -taupen I saw HHVM was listening on port 9000 on the VM which should have been a clue to why it wasn't working, I set hhvm: false in my homestead.yaml to no avail.
After more fiddling I saw that phpinfo() was giving a message of 'HipHop', A quick look at Google again led me to HHVM.
What I didn't do before was reprovision my homestead which sometimes is needed when changing stuff in the config. So after a homestead provision HHVM was fully disabled and xdebug was working.
Also word of warning, editing xdebug settings in the ini requires a restart of php fpm, nginx alone is not enough. Do a sudo service php5-fpm restart.
Just a quick note I tried all of the above provided solutions
My Solution:
for PHP7, Laravel 5.3 and homestead
vagrant ssh
sudo apt-get purge hhvm && sudo service nginx restart
After purging hhvm from the system xDebug works as expected.
Description:
In newer versions of laravel/homestead hhvm is not supported anymore but is still running!
They took all descriptions out of the documentation. (Laravel 5.3)
hhvm: false in the Homestead.yml config does not work anymore!
Tried it in every possible location of the Homestead.yml file, but if you reprovision and boot up homestead the hhvm instance is still running and listening on port 9000...
First I tried to change xDebugs listening port to 9089 which did not work. (yes I restarted fpm)
At some point I got annoyed and purged hhvm from the homestead vm.
Now everything works as expected.
Note: The provisioning is not reinstalling it.
Hope this helps someone and thanks for pointing me into the right direction
Related
I am using PhpStorm.
PHP Version 7.2.7 and Xdebug version 2.6.1
I have change the port to 9001 instead of 9000 (because it is listening to TCP)
Not it is listening to port. I have put breakpoint. But still it is not debugging.
Is there any setting I am still missing?
In Debugger: it is showing to 'Connected to localhost:65451' and project is demo.local (virtual host)
In Run -> Stop Listening to PHP Debug connections already have
I cannot comment so I am adding what worked for me here.
I was struggling with this thing from quite some time and I installed this extensions
Xdebug helper
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc/related
and it works for me!
Basically check if your phpstorm configurations are all right.
https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html
Then I tried 3 plugins
JetBrains Toolbox Extension (didn't worked)
https://chrome.google.com/webstore/detail/jetbrains-toolbox-extensi/offnedcbhjldheanlbojaefbfbllddna
JetBrains IDE Support(had some problem communicating with phpstorm or didn't worked )
https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji
Xdebug helper (worked! yeeey )
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc/related
and that's it :D
I've recentlly got a problem with my local virtual hosts after installing php 5.6 next to php 7.0. I'm using Ubuntu 16.04 with Apache, MySQL etc. configured for Laravel projects and everything was working perfectly fine with php 7.0 until I had to work with another project. This non-laravel project required php 5.6 to work, so I installed it next to php 7.0 together with some modules for phpmyadmin (as it didn't work after I switched server to php 5.6). So what I did after installing php 5.6 was:
sudo a2dismod php7.0
sudo a2enmod php5.6
sudo service apache2 restart
Added a new host for my php 5.6 project in /etc/hosts as 127.0.0.1 www.myhost.local.
Added a new config in sites-available, enabled it, restarted the server.
Installed few required by phpmyadmin modules to configure database for the new project.
Worked with my php 5.6 project.
When I wanted to switch back to my Laravel projects I made:
sudo a2dismod php5.6
sudo a2enmod php7.0
sudo service apache2 restart
And none of the laravel hosts worked. The error I get from Google Chrome is:
This site can’t be reached
www.myhost.local’s server IP address could not be found.
ERR_NAME_NOT_RESOLVED
And I DIDN'T CHANGE configs of Laravel projects! I didn't edit neither sites-availavle configs, nor etc/hotst except for adding the line with my php 5.6 project. I've tryed:
Checking /etc/apache2/mods-enabled where are php7.0.load and php7.0.conf enabled.
Checking service apache2 status and got Apache active (running).
Checking http://localhost/ and got the default apache page.
Checking http://localhost/php.info which showed me that server is running with php 7.0
Deleting php 5.6 host from etc/hosts and disabling same config in sites-available.
Adding < VirtualHost 127.0.0.1:80 > instead of < VirtualHost *:80 > in the beginning of my Laravel host config. Which made some inner pages work if loaded without www and home page still didn't and www was added to url every time I tryed to load it. However some inner pages began later to generate www too and nothing helped :(
Checking apache logs and got warnings only.
Some other minor things I can't remember now...
Can anyone help please? Or is it easier to reinstall php completely?
Thanks everyone! That was browser cache (although I've checked other browsers I never opened my projects in). So it finally worked in incognito window and after I cleared Chrome's and FF's cache.
First, I'm running macOS High Sierra, with Homebrew's PHP 7.1
I've also followed the Valet documentation to the letter, as well as trying what was on these asks: Valet (Laravel): DNS address can not be found and Laravel valet It works aaaaaand, despite all of that, when I navigate to project.dev, I just get "It works!" I was having issues pinging, but that turned out to be Stealth Mode in the macOS Firewall.
I have Laravel set up in this directory, so I SHOULD be getting the default splash page, right?
Also, in case it matters, here's the line I used to install PHP 7.1 itself: brew install php71 --with-httpd --with-pear --with-postgresql --with-thread-safety --with-homebrew-curl
You should check your settings related to firewall. Make sure you are allowing pings and ICMP.
To check it on a Mac :
System Preference > Security & Privacy > Firewall > Firewall Options
This sounds like the Apache that comes pre-installed with macos is running in the port 80. Before starting valet, make sure that Apache is stopped.
You can these commands: sudo apachectl stop or sudo apachectl -k stop to stop Apache, and after that, then you can proceed with your valet process.
Hope it helps.
So I'm starting to use MySQL and phpMyAdmin and I firstly installed Apache2.4. After installing Apache2.4 there were numerous errors so I decided to install XAMPP instead. Now me not thinking through the consequences deleted the Apache2.4 Folder completely along with all its contents.
So now when I start XAMPP, MySQL runs fine but Apache is stuck on "Attempting to start Apache service..." Now when I look at the services tab Apache2.4 is still on my list, I have disabled it but it's made no difference. I have checked through my computer for any remaining Apache2.4 files but I can't find any.
If anyone can help me with this, it would be extremely helpful!
UPDATE: I have restored Apache24 from my recycling bin, should I attempt a uninstall using cmd?
It appears that an instance of apache 2.4 is running on the system. It is probably locking port 80 which the reason why XAMPP apache is unable to start.
Shutdown apache 2.4 from it's control panel, shutdown the service, and ensure there is no "httpd" process running using task manager. If there is kill it.
Once the above are done you should be able to start xampp.
Follow those steps:
1- Uninstall Apache 2.4
2- Clean Windows Registry with a tool like CCleaner
3- Restart Windows
4- Install XAMPP
I'm trying to install zend debugger in my Ubuntu 9.04 machine, I've done it in win. but not in linux, I hope you could help me, this is what I've done:
1)Copied the file ZendDebugger.so to /etc/php5/apache2 (didn't choose this folder for anything in special).
2)Added this lines to php.ini:
zend_extension="/etc/php5/apache2/ZendDebugger.so" zend_debugger.allow_hosts=127.0.0.1,127.0.1.1,localhost,*
zend_debugger.expose_remotely=always
I've also tried without quotes(zend_extension=/etc/php5/apache2/ZendDebugger.so)
3)Copied file dummy.php to /var/www
And then restarted Apache but I didn't see the information about Zend Debugger in the phpinfo(), the only related thing I found there was report_zend_debug On.
Thanks in advance
I found much more easy to install Xdebug in my Ubuntu machine.
sudo mv /etc/php5/apache2/ZendDebugger.so /usr/lib/php5/20060613/ZendDebugger.so
This is where your memcache.so, apc.so, etc. are located. Unless you modified your php extensions directory that is where new exts should go.
In php.ini:
zend_extension=/usr/lib/php5/20060613/ZendDebugger.so
cd to that directory and chmod a-x ZendDebugger.so to remove executable bits from the .so.
sudo /etc/init.d/apache2 stop
In another terminal window, tail -f /var/log/error.log and clear console so it is easy to see new log entries coming in (cmd-k on macos).
Then:
sudo /etc/init.d/apache2 start
If there are no errors in error.log, check phpinfo() and see if the debugger section shows up.
You might get errors in the configuration of other php extensions that occur further up in php.ini (e.g., xcache or eaccellerator) that will make loading stuff further down in php.ini problematic.
This is a baseline setup and should work if there are no other problems.
You can also try to install Zend Server Community Edition
You'll get Zend Debugger enabled by default, along with some other nice features. There is a link to the deb repository available through the download page.
I followed the same steps that you did with the same result. In the end the problem was that I was trying to load a 32bit binary with apache running in 64bit mode base (as described in this post) I was able to get it running immediately by doing the following.
stopping apache
executing sudo arch -i386 /usr/sbin/httpd
restarting apache.
After replacing the 32bit binary with the 64bit binary everything worked as expected with no special apache handling. There was also some facepalming involved, but it did not affect the overall outcome.