xdebug ignores xdebug.remote_host=localhost:8080 using NetBeans - php

I am running on Windows 10 with NetBeans 8.2 and XDEBUG 2.5.
When I click Debug/File Chrome opens with
http://localhost/d8mod/modules/custom_modules/emailreminder/emailreminder.module?XDEBUG_SESSION_START=netbeans-xdebug with "Site can't be reached".
php.ini contains xdebug.remote_host=localhost:8080
the :8080 part is ignored. It does not matter whether it's in quotes on not.
What am I doing wrong?

I think, you'll have to update your project settings in Netbeans, because it calls the wrong URL.
The URL Netbeans calls after pushing the debug button is configured in project settings / "Run Configuration".
The field "Run As" should be "Local Web Site (Running on local web server)" as you're using localhost and the Project URL should be http://localhost:8080/[Project PATH], where [Project PATH] is the path to your project.
I hope, this helps.

Related

How to set up a new PHP project in NetBeans IDE (version 8.2 or 11.3) using WampServer?

I have done the following steps, but still I get the error 'Not Found' (with the description: Not Found
The requested URL was not found on this server. Apache/2.4.41 (Win64) PHP/7.3.12 Server at localhost Port 80) in tow different versions of NetBeans 8.2 and 11.3.
Step 1. Running WampServer Version 3.2.0 64bit installed on Windows 10 OS ==> I see the green icon in status bar, indicating all services are running.
Step 2. In NetBeans IDE I created a new php project (File > New Project; chosen in the Categories list, PHP). Then next as follow:
NetBeans IDE 8.2
and in NetBeans IDE 11.3:
Step 3. I left the configuration settings by their default values as the following picture:
NetBeans IDE 8.2
and in NetBeans IDE 11.3:
Finally, when I run the application I get the following output on my browser: Not Found! for both the versions.
Does anybody know how this error can be handled?
your sources Folder is c:/wamp64/www/Netbeans/php
so your Project URL had to look like this http://localhost/Netbeans/php
Have you create the index.php file?
There is a simple test,
type in your browser: http://localhost
when there is a folder named Netbeans open it
next click on the php folder and in this folder there should be the index.php file when you created it
I found a way that can solve this problem to set up a local web site configuration as follows:
Click right on the project name and choose properties.
From categories click on Run Configuration
In right panel, from the Run As dropdown list, choose Local Web Site.
In the Project URL field, check the automatically generated URL address. Then specify the port number explicitly, in the format localhost:<port number>.
As shown in the screen shot below:
Click OK and run the project again to see the output on the browser.
In the picture above, in the Project URL field after the port number, you can add any arbitrary name optionally, like the project name if you are going to have more projects running on the same port.

Running PHP on Windows 10 - Server problem?

My computer is a Windows 10 64 bit.
I tried to run my PHP code, steps:
Downloaded php.net.
Set the environment variables path as instructed. Ran the command line like this: https://imgur.com/a/Q9zs9mL
Microsoft Windows [Version 10.0.17134.345]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\Mai Do>php -S localhost:4000
PHP 7.2.10 Development Server started at Mon Oct 22 21:04:32 2018
Listening on http://localhost:4000
Document root is C:\Users\Mai Do
Press Ctrl+C to quit.
Created a PHP file, first with NetBeans
Saved the file in the root directory folder named "php1" (try to be different from my root name)
Typed in browser: localhost:4000/php1/input.php
Object not found 404 page.
Tried multiple times with different php file. same thing.
Switch to Atom. Same thing.
Moved the file to htdocs folder. Same thing
Download Xampp. Turn on the Apache and MySQL. XAMP ver 3.2.2 control panel shows up. Both Button turn to Green. Still not found.
This SO page PHP not working in XAMPP says:
If you're trying to connect via your IP then your router must be
stopping it so you have to sort the settings out. I don't know your
router make/model you better off asking their support forums.
I am thinking there might be a server config problem. Like this one has a similar issue: Apache2 not working with routes PHP
which leads to this:
https://docs.bolt.cm/3.0/howto/making-sure-htaccess-works
"Editing the apache2.conf and setting 'AllowOverride All' on , finally
works." ???
I am not sure if that is the right problem either. Can someone walk me through it? Bless you.
To set up a test environment on your personal computer, follow the steps below:
Remove any installed PHP (Windows: uninstall via "Add/Remove Programs")
Install XAMPP (in your case, it's better to re-install the software suite)
XAMPP is a software suite that contains PHP + MariaDB (a fork from MySQL) + Apache Web Server + Perl. In your case, you are going to use PHP & Apache only.
Configure the DocumentRoot in Apache config file; you should put your website files in this DocumentRoot, thus I recommend you to set the path value to your development path. Read the manual if you're unsure how to do so.
Start/Restart Apache. If everything goes smooth, Apache should be up and running at port 80 (by default).
Launch your favorite browser and navigate to http://localhost
You should see your website written in PHP
If you have any further questions, please ask in the comment box below.
Note:
NetBeans is an IDE, not related to your testing environment
You can actually write your PHP scripts using any text editor

netbeans 8 does not refer to the actual PHP file path, when running a PHP file

I have installed php, mysql and nginx properly.
I am able to run the PHP pages from Eclipse, i.e Eclipse opens up chrome, and pages are displayed correctly.
I imported my existing PHP project into Netbeans.
When I try to run any of the php pages, netbeans opens up chrome, but the web address is always the same, and not the real path of the PHP file.
Why netbeans refers to the same location, instead of trying to run the file from its real path? how can I fix it?
Thanks,
Qwerty
I found the solution.
The green "play" button in Netbeans does not run the current file, but runs the PROJECT! This caused eclipse to run the project path instead of the current file location!
Therefore, in order to run the current file click on "Run -> Run File" (Shift +F6), and then it works.
Just make sure that the project path is set properly in "Run->Set Project Configuration -> Customize", and then set the project URL to:
http://localhost/
That`s it!
Thanks,
Qwerty

Adding an external server in Aptana Studio 3

How can I add an external server in Aptana Studio 3, since there is no Servers view?
Here are some instructions on how to do it but they both use Windows > Show view > Servers which is no longer available in Aptana 3. With the console is possible? How?
I have a wamp server installed and I can run correctly php files stored inside the htdocs folder. Now I want to run those php files from Aptana but I was getting blank pages.
In Project > Run Configurations I noticed the "Use selected server" option but no possibilty to add a server there, so I used "Use base URL" together with "Append project name" and now I can run php files from Aptana but I am still wondering if it is the best option and how I could tell Aptana to use the wamp server.
In Aptana Studio 3 you need to open Preferences, Aptana/ Web Servers node and add your local apache server there.
If you set the document root correctly, your apache server will be used for previewing in Studio (See Preview button on toolbar).
Just add an alias in my apache config like
Alias /aptana "C:/Aptana/Aptana Studio 3 Workspace"
where I have MyApp project in Aptana,
Then in Run cnfiguration, Web Browser, My Apache Server,
Use base url = http://<domain><port>/aptana/
In my browser URL : http:///aptana/MyApp
That's all
I solved it by following method:
1.find the httpd.conf in {path to Apache}/conf/, set the "DocumentRoot" value as your
Aptana workspace.
2.Run->Run Configurations.. choose a web browser, set the "Use base URL" value as http://localhost/{here is your project name}/
3.run.

xdebug with Netbeans and PHP works with project custom domain only if project root is selected

When I debug a PHP project in Netbeans with xdebug, I have to select the project root first, and then click on the debug button. That way it works ok, firing the browser with the project's local domain (not localhost, but one I defined).
But if the project root is not selected, suppose some inner folder or file was last clicked on, then if I hit the debug button, instead of using the project's domain, it uses localhost, which on my machine is not the project I'm trying to debug.
Is there a way that the project domain is always used for debugging, instead of localhost?
try this (on netbeans v6.9.1)
Project Properties >> Run Configurations >> Advanced >> Debug URL ::
CHECK "Ask Every Time"
#Your last project URL is automatically saved in history
NetBeans should still debug with the URL you set in Project Properties > Run Configuration > Project URL, at least that's how it works on my install.

Categories