Netbeans with xdebug not highlighting debugged lines - php

I finally managed to get xdebug working but now I am facing a strange problem. I can see the variables, I can step through the code but i can't see what line I'm actually debugging. Any ideas?

If you don't see highlighted lines, it's possible that the project settings aren't configured correctly.
E.g. when using a htaccess redirect from the root folder to folder myapplication, be sure to edit Project->Properties->Sources->Web Root to the redirect folder.
That solved the issue for me.

Under Netbeans > Project Properties > Sources, be sure that the Web Root is set right to refer to the directory where the running page is. This could be one of the possible reasons of the problem.

I ran into this same issue, and it was because I did not set up Path Mapping in the project.
Project -> Run Configuration -> Advanced
More info here: https://blogs.oracle.com/netbeansphp/entry/path_mapping_in_php_debugger

In my case what seems to have fixed the problem is to right click the file (in my case a java file) choose "select in projects" then it asked me if I want to open the project (actually this is what I think was happening, I had the file opened but not the project), I said yes and then netbeans started to show me the line as it goes debugging.

Related

Xampp not showwing my projects in browser - htdocs folder

I used windows 10 as the operating system and I installed xampp it's been a long time and it chews well, until yesterday after an error in mysql.
So I looked for solutions on the internet and I finally solved the error by copying the files from C:\xampp\mysql\backup to C:\xampp\mysql\data.
then the service mysql is well marketed even as Apache.
PhpMyadmin chews well without a problem. phpmyadmin page shows, but my code, will not show.
The problem is: my old projects exist in htdocs only display "This page does not work" and "localhost" in the title head, and nothing loads from my project files.
Note: I used codeigniter as a framework.
Note: I can navigate to a new project but for existing projects beyond that it no longer works.
Thank you P.al
Use Directly like-
http://localhost/projects/form.html
Here your files should be inside C:\XAMPP\htdocs\Projects\yourfile.html
The error in your picture appear an php script error
Edit php.ini for display error and notice in browser
display_errors = on
save the php.ini restart apache and reload page.

Local xampp wordpress installation - cannot find wp-blog-header.php

I'm working locally with XAMPP and Wordpress and I'm struggling with what is probably a very basic config issue. I'm not a professional IT guy, just a hobbyist hacker so I apologise in advance if I'm being a bit dumb but hopefully somebody can kindly offer some assistance here.
I've installed xampp locally on my iMac. I've then installed wordpress using the xampp wordpress installation package. Both seem to be working fine. To test the web server I created a simple .php test file and this generated the expected output when I entered "localhost/hello.php" into my browser. As far as wordpress is concerned entering "localhost/wordpress" gives me access the local wp interface to create and edit posts, change display settings etc etc. So far so good...
Now I want to create a new .php file that includes the instruction:
require('XXX/wp-blog-header.php')
where the "XXX" is obviously the relevant directory path for the wp header file.
I cannot find this file, or indeed local wordpress files, anywhere (and I've searched extensively). In the "home" location for "localhost" (which I know from my "hello.php" test) there isn't even a wordpress directory so I'm totally puzzled as to how typing "localhost/wordpress" in my browser is accessing the local wp installation or how to go about determining the correct directory path for the wp header file I'm looking for?
I do understand that with this stack a great deal of info will either be generated on the fly, or stored in the local mysql database as opposed to the file structure, but I thought I would find some reference or alias somewhere to help me trace this through and determine what path to include in my .php file for wp-blog-header.php.
I've searched this forum and while there are several related questions I haven't found anything that helps me with this particular issue.
Thanks vm,
Ian
The location of your Wordpress files is:
/Applications/XAMPP/xamppfiles/apps/wordpress
Ok I found the path I needed and (partially) understand why I couldn't locate it. As Scriptonomy helped me identify the Wordpress files are held at:
/Applications/XAMPP/xamppfiles/apps/wordpress
While my test.php file is held at:
/Applications/XAMPP/xamppfiles/htdocs/test.php
The reason I couldn't locate either wp-blog-header.php or wp-load.php is because these there is an another "htdocs" sub-dir under the wordpress install location i.e.:
../apps/wordpress/htdocs
However I (as user "admin") don't have access to read this directory and so couldn't see the contents and therefore couldn't find the files. The permissions on the directory belong to "daemon" which I guess was the XAMPP installer package? Setting the directory path in my test.php file to:
../apps/wordpress/htdocs/wp-load.php
somehow the web server (?) can read the file (even though I can't see it myself via the Finder application) and so the code is now giving the expected result.
So problem solved even if I don't quite understand the solution!
Thanks for replies which helped me eventually get to a solution!
Cheers,
Ian

WAMP does not open my project

I am completely new to web-dev and wamp, I have to use it for a college project to build a website using php. I installed the newest version of wamp. I cloned my project repository into the www folder.
When I run "localhost" in the browser, I get the generic wamp page and I can see my project folder on the bottom of the page under the "Projects" heading
when I click on the project it does not open and I get a 404 not found error. This is not the same issue a thousands other people have written about, where when they uses the path "localhost/projectname" they get access to their project but when they just click their project the path is "projectname" and they dont see their project. I have read tons of posts with people that have that problem and I do not think I have the same issue becase when I click on my project link on the wamp hompage, I get the complete path "http://localhost/PaperCloudBackend/" and this shows a 404 error
Keep in mind that all I have done with wamp so far is:
1) install it
2) clone repo into www folder
3) opened browser with localhost
4) clicked on my project name
I would really like a concise answer to why this is happening so I can learn the root cause, and also a solution to the problem because i have not contributed to my team codebase at all and I have not been able to solve this issue after 1 week.
Thanks
I assume that its an .htaccess error which is clashing . If you have .htaccess in your project then check it if you have given the correct url in the .htaccess rule or you can delete the file(.htaccess) and run the project in your browser.
Another problem that you should check is there any index file is present in the root of the folder you are trying to access.
I hope this might help you.
Currently thats also happed with me on window8.1, To prevent this open the index.php file from root directory wamp/www/index.php.
Change
$suppress_localhost = true;
To
$suppress_localhost = false;
Hope this will help you to fix the problem.
Please make sure that index file exist in your "PaperCloudBackend" directory as it is the entry point of execution.

php is not recognized as an internal or external command using xampp

I am using xampp, so my php folder is in C:\xampp\php\ and I add in my PATH environment variables the C:\xampp\php\ but when I am running on cmd the php command I am getting the following message:
php is not recognized as an internal or external command.
Any idea what I am missing?
When adding an entry to environment variables make sure you leave no spaces between the semicolon and the new path.
I spent a couple of hours going over my steps until I realized that the only difference between other path entries and mine was a single empty space. So i changed it and tried again at the command window (no need to log off and back on) and it worked!
I realize this was asked a while ago but since I found myself looking for a solution i figured this might be helpful to other people too.
Here iam sharing some screenshot about adding Environment variables in windows 10 PC
Step 1
Open Control panel and search for environment variable.
Step 2
Select Environment variable.
Step 3
Select path that shown in the below image.
Step 4
click on edit button.
Step 5
Click new button.
Step 6
Add your php file path like given below.
Path may different according to your server.
Then click Ok that's It.
In latest Xampp, path to PHP.exe has changed to this. Means we will have to add this new path in our PATH environment as I mentioned at another Stackoverflow Question.
PHP.exe new Path in Xampp

Why does Eclipse code completion not work on some projects?

I have Eclipse 3.3.2 with PDT doing PHP development.
All projects that I create, even SVN projects have code completion.
Now I just opened another SVN project and it has no code completion or PHP templates (CTRL-space does nothing in that project).
However, I can open the other projects and code completion all work in them.
Why would code completion and templates be "off" in just one project and how can I turn it back on?
Maybe Eclipse doesn't understand the project has a "PHP nature".
Try comparing the .project file on both projects to look for differences. It should contain something like:
<natures>
<nature>org.eclipse.php.core.PHPNature</nature>
</natures>
The .project file will be in your workspace under the project directories.
Look out for the file .buildpath in your project... put this line between the tag:
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
Save it and restart eclipse. Now everything should be OK... This worked for me. :)
Thank you!
I spent all day long to figure out why I did not have code completion...
The problem is that if you create a SVN project the .project is a basic file without codecompletion reference. You have to create a basic PHP project and compare the two files and replacing the missing part in the SVN project one.
Now I have code completion for every file in the project, even for Zend Framework library
It is just one line to add in the .project file and then restarting eclipse to get codecompletion:
Where it says
---
<natures>
</natures>
---
after the change has to be
---
<natures>
<nature>org.eclipse.php.core.PHPNature</nature>
</natures>
---
That should do.
#Guido PHPNature does not fix this.
#Edward Tanguay Yes, that's because when you create new PHP project, eclipse adds .buildpath file with
<?xml version="1.0" encoding="UTF-8"?><buildpath>
<buildpathentry kind="src" path=""/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/></buildpath>
when you import existing project you eclipse does not generates .buildpath file, but you can add it by hand or create new PHP project with existin source (you can choose in wizard).
I have the same issue sometimes. For me it works to rebuild the PHP project with "Project" -> "Clean".
If you have this problem, follow these steps :
Select "PHP Include Path" in your project tree
Right click on it then click "Build Path>Configure Build Path"
On the opening window,add folder that you want to build, so it can do code assist.
Thats all :) I hope it resolves your problem, I solved my one :)
Be sure the file opens with the "PHP editor". Right-click the file, and select open with to select the right editor.
If it turns out you've been using the wrong editor, you can change the association under Preferences » General » Content Types
Right click in the edit screen, goto Java -> Editor -> Content Assist -> Advanced ...select proposals accordingly
ATTENTION
Besides the already mentioned solutions to get the whole autocomplete help to work, there is another quirk: it might not be enabled.
Go to Window > Properties and then to PHP > Editor > Code Assist (JAVA has a similar option) and set "Enable auto activation", preferably with a delay that you see comfortable (0ms). If you are bothered by the program suddenly deciding to do things for you without prompt (and doing it wrong), deselect "Insert single proposals automatically" and you should be fine.
I've noticed sometimes when you checkout a project from svn in eclipse (subversive or subsclipe "checkout a project as") and even though you check it out as a php project it will either delete the .project file or it would be a generic project. I've found to just go in that directory and delete the .project .settings/ and .cach/
Then create a new php project and point the directory where you checked out the files. And you should have code completion and svn should be link to your repo.
I had a problem that build path was empty, so no code completion for any of the files i tried to edit. Make sure you setup properly your build path, especially if you're linking the source from some other location than the workspace.
Like the apache htdocs folder for example.
I have solved this by enabling the Full C/C++ indexer (Windows-> properties -> C/C++ -> Indexer), and also hit the radio button "Use active button configuration". After that Clean, and Build all.
That worked on Eclipse CDT 3.4
If you came here looking for code completion in php eclipse not working, make sure your project is being supported as a php project. Right click on the project and then go to configure -> Add php support. If you have the right settings for code assist it should work instantaneously. Sometimes newbies as me tweak around with the projects or start projects as clean and not as php so eclipse doesn't know how to treat the project.
I had to right click the project in the PHP Explorer, go to "PHP Build Path". This was empty. I clicked "Add Folder", selected the checkbox next to the root folder of my project and clicked "OK", then "OK" again.
After that code completion seemed to work. Should just work out of the box if you ask me, but whatever.
Check the lib of your project. It may be that you have include two such jar files in which same class is available or say one class in code can be refrenced in two jar files. In such case also eclipse stops assisting code as it is totally confused.
Better way to check this is go to the file where assist is not working and comment all imports there, than add imports one by one and check at each import if code-assist is working or not.You can easily find the class with duplicate refrences.
One solution could be to include a dummy php file wich requires all your PHP classes. So that the PHP parser recognizes these classes too.
Example dummy file:
if(false) {
require_once 'class/one.php';
require_once 'class/two.php';
require_once 'class/three.php';
}

Categories