Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Problem running Eclipse PHP with WAMP & Xdebug (port conflict?)(Problem running Eclipse PHP with WAMP & Xdebug (port conflict?))
Problem running Eclipse PHP with WAMP & Xdebug (port conflict?) [message #1815585] Sun, 06 October 2019 14:15 Go to next message
DI V is currently offline DI VFriend
Messages: 20
Registered: October 2019
Junior Member
Hello, Eclipse experts.

I am hoping you can help me with setting up Eclipse PHP to run with WAMP and Xdebug.

I have installed the latest Visual C++ files need by WAMP, the latest WAMP, the latest JRE x64, and the latest Eclipse PHP (from the installer) within the last few days.
I am running on Windows 8.1, 64-bit.

I got WAMP installed OK, and tested that it can allow display output of PHP files under c:\wamp64\www in my browser (including HTML, PHP and JS).
From the default index.php which provides a link to phpinfo (at http://localhost/?phpinfo=-1 ) I paste into https://xdebug.org/wizard
This tells me: "You're already running the latest Xdebug version"
There are some instructions that it shows "anyway". My php.ini file has the required instructions active (except that there is apparently a misprint in one instruction, which is correct in the php.ini: ...\ext\php_xdebug-2.7.2-7.3-vc15-x86_64.dll should be .../zend_ext/php_xdebug-2.7.2-7.3-vc15-x86_64.dll , because that's where the file is on my HDD.)

I originally set my WAMP/Apache to listen on port 80.
I apparently got Eclipse to run my test php files, and display the corresponding browser output, but struggled to get it to hit breakpoints. Eventually I also got this working. Then 'something' happened, and I managed to crash Eclipse two or three times :-P From that point on I am struggling to get anything to work in Eclipse.

I started getting a message saying "Port 80 required by PHP built-in server at localhost is already in use."
There were also some online resources suggesting that this port setting should be changed anyway, as a matter of course, to something like 8000 or 8888. Through the WAMP menu I changed to port 8080. Then I got errors about "Port 8080 required by PHP built-in server at localhost is already in use." This was for both attempting to run and attempting to debug.

I decided to 'reinstall' Eclipse PHP. This involved manually deleting all of the Eclipse files in my user directory, except .p2 -- I only realised just now that I should probably have also deleted the project files to start afresh (oops!) -- and then installing Eclipse PHP anew from the installer (with bundles).

I am still getting port errors.
I have checked with the commandline command "netstat -aon", and initially httpd (I think) appeared to be in conflict.
I have tried a system reboot, and running Eclipse both with or without WAMP running. Is there any recommendation about whether (or not) WAMP should be run while Eclipse is running?

I still get the port error message when netstat confirms that nothing is on the relevant port other than Eclipse itself. Maybe Eclipse is not 'releasing' the port or 'stopping' the server?? My PHP code is like "<?php echo "PHP is working!"; ?>" ... "<script> document.write("JavaScript is working well!"); </script>". I am not aware that I need to send any explicit command to ask the server to stop listening to events (I enabled JS support).

I am unsure whether I am entering the settings correctly:

As default PHP server I have:
Server
Name: Default PHP Web Server
URL: http://localhost:8080
Root: C:\wamp64\www
Debugger
Debugger: Xdebug
Port: 9000
Path mapping
Server: http://localhost:8080
File system: c:\wamp64\www

I am not sure whether I should explicitly include the port 8080 both times, and whether the mapping is needed.

I created a project for my existing test file in c:\wamp64\www\TestABC , with project name TestABC.
When I first try to run this file with Run on Server I get a dialogue asking which server to use. I don't know why it refuses to use the existing defined (default) server, but under "Manually define a new server" I chose "PHP Built-in Server", with server name "localhost".
What is bizarre to me is that this ends up creating another server, but it is on port 8583! It has no debugger defined.

The first time around, this will run the file. Then if I try to use the newly defined server on port 8583 to run the file again, I get the abovementioned port error.

The new server has no debugger defined.

My default server in Eclipse has Xdebug defined as the debugger.
In the "Debugger" tab of the "Edit Server" dialogue there are no problems noted. However, when I edit the PHP executable (version 7.3.5), on the "Debugger" tab there it states: "Xdebug extension is not installed."
As far as I know, Xdebug is installed. But perhaps Eclipse is not finding it for some reason (which I cannot figure out). I don't remember seeing that message when I configured Eclipse in the first installation (unless I simply didn't notice). Is it possible that the ext versus zend_ext directory discrepancy could result in Eclipse failing to find Xdebug?

The only other thing that occurs to me is that WAMP recommends a dedicated Virtual Host be created for each project (i.e. each subdirectory under www, or elsewhere), which I haven't done. But, as I mentioned, that initially wasn't causing a problem with the first-installed Eclipse.

Sorry it's a long post. I hope I've included some useful background information on my problem. Please let me know if I need to provide other information or check anything particular.

Thanks in advance,
DIV

[Updated on: Sun, 06 October 2019 23:09]

Report message to a moderator

Eclipse files in project directory [message #1815591 is a reply to message #1815585] Sun, 06 October 2019 15:11 Go to previous messageGo to next message
DI V is currently offline DI VFriend
Messages: 20
Registered: October 2019
Junior Member
I have just gone through the Eclipse files in the c:\wamp64\www\TestABC project directory, and there is nothing notable there.
More weird port behaviour [message #1815601 is a reply to message #1815591] Sun, 06 October 2019 23:39 Go to previous messageGo to next message
DI V is currently offline DI VFriend
Messages: 20
Registered: October 2019
Junior Member
Here is something else truly odd.

I edited my test PHP file 'manually' outside of Eclipse.
With WAMP running:

  • In Eclipse and in my browser http://localhost:8080/TestABC/testIndex.php displays the output of the current PHP file code.
  • In Eclipse and in my browser http://localhost:8583/TestABC/testIndex.php displays the output of the previous PHP file code (which doesn't exist anymore), no matter how many times I refresh. This behaviour also occurs in a browser where I never loaded the file with that port number before, so it seems not to be a browser cache issue. Is Eclipse leaving copies on the 'server' associated with this port?
  • All other ports give the expected error: "This page can't be displayed".


--DIV
Small victory [message #1815602 is a reply to message #1815601] Mon, 07 October 2019 00:03 Go to previous messageGo to next message
DI V is currently offline DI VFriend
Messages: 20
Registered: October 2019
Junior Member
OK, I just had a small success.

I thought before the option of "Run As > PHP Web Application" wasn't working, or had caused problems.
(In case it wasn't clear, my test file has PHP wrapped in HTML.)
I tried it again just now, and the first thing I noticed was a dialogue box with a message something like "... will not be published on the server"*. That sounded promising, because of the previously documented problem I had with old code being cached and the port numbers being locked up.
Anyway, my PHP file seemed to run correctly. It used port 8080.

Next I tried "Debug As > PHP Web Application". First I was asked whether I'd like to switch to the debugging 'perspective', which I opted to do.
This also seems to work perfectly.

I tried to go back again to run again. I noticed that this time choosing run as before instead resulting in entering a debug mode. Furthermore, I noticed that even if I hit Resume so that the code runs to the last command, the debug 'session' doesn't end. It only ends when I click the red Terminate button (even though Resume is inactive, because there's no more code to parse).

I can hit breakpoints now even in a secondary PHP file that is called by my main PHP test file.
(Incidentally, my project initially didn't include the secondary PHP file, because I created it today outside of Eclipse. So Eclipse complained that the file didn't exist. I couldn't find a way to add the file to the project, or to get the project directory to refresh. In the end I manually opened the secondary PHP file, and -- luckily -- when Eclipse opened it up it automatically associated the file with my test project. But that behaviour/workflow seems a bit clunky.)
[EDIT: Right-clicking the Project within the Project Explorer brings up a context menu, for which Refresh may find new files manually added to the Project folder(s).]

So maybe Eclipse is working????
And maybe -- despite the warning message I got -- Xdebug is also working?!?!

I'd still appreciate feedback on what I described above: advice on whatever I was doing wrong (with explanation of why it's wrong), whatever I could do better, and anything that looks like a genuine bug.

Thanks,
DIV

* I'm not sure what the message was exactly, because it's no longer displaying now that I am 'stuck' in the debugging 'perspective'.
[EDIT: Perspective can be changed from Window > Perspective > Open Perspective > {Debug, PHP}.]

[Updated on: Tue, 08 October 2019 09:04]

Report message to a moderator

Motivation [message #1815603 is a reply to message #1815602] Mon, 07 October 2019 00:08 Go to previous messageGo to next message
DI V is currently offline DI VFriend
Messages: 20
Registered: October 2019
Junior Member
By the way, my intentions for debugging PHP are:

  • Debug templates and plugins that currently run well in Joomla! 3, but are not working properly in Joomla! 4.
  • Write mathematical functions & algorithms in PHP that will produce numerical values & arrays. (I will then want to display arrays on a webpage as tables and/or graphs.)

[Updated on: Mon, 07 October 2019 00:09]

Report message to a moderator

Re: Motivation [message #1815604 is a reply to message #1815603] Mon, 07 October 2019 00:40 Go to previous messageGo to next message
Emmanuel Chebbi is currently offline Emmanuel ChebbiFriend
Messages: 29
Registered: February 2018
Junior Member
Hi,

Sorry I'm not really aware of how to use PHP within Eclipse IDE. I advise you to ask your question on the PHP Forum or maybe on the Web Tools Forum: you're more likely to have an answer there.
Re: Motivation [message #1815656 is a reply to message #1815604] Tue, 08 October 2019 04:26 Go to previous messageGo to next message
DI V is currently offline DI VFriend
Messages: 20
Registered: October 2019
Junior Member
OK. I thought my question might be too simple for advanced users, so I posted here. I will try another forum. Thanks for the suggestion.
--DIV
Cross-posted on PDT Forum [message #1815658 is a reply to message #1815656] Tue, 08 October 2019 05:01 Go to previous message
DI V is currently offline DI VFriend
Messages: 20
Registered: October 2019
Junior Member
Posted on the Eclipse PHP Development Tools (PDT) Forum at https://www.eclipse.org/forums/index.php/t/1100875/ .
Previous Topic:'Updating Software' has encountered a problem.
Next Topic:Sirius validation issues with newValue / selection input
Goto Forum:
  


Current Time: Sun Oct 20 06:14:35 GMT 2019

Powered by FUDForum. Page generated in 0.02738 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top