I am using Laravel 4.2, with the public directory being /htdocs and the logic files are kept in /htdocs/../soft. I am using PHPStorm 9 to debug this app. I've set the interpreter to php.exe from the XAMPP package, and in the Deployment stettings I've added a Local or mounted folder deployment with Upload/download project files set to C:\xampp\htdocs. I've added the htdocs/../soft into the Directories of the project in PHPStorm.
Debugging does work for /htdocs/index.php when debugging the file itself debug index.php, but not when debugging using the browser. How do I configure PHPStorm to debug this directory structure "in browser". I got xdebug installed and the JBeans extension as well.
Related
I know this is not a new question but I think something has changed with Xampp in the latest version. I was using Xampp 8.0 and was using another directory to serve as localhost just fine. My Xampp installation is in C:/xampp while my projects are located in D:\Whip\Projects. This is the folder I want to load when using the address localhost.
I changed 2 lines in httpd.conf like I had done several times before
DocumentRoot "D:\Whip\Projects"
<Directory "D:\Whip\Projects">
The folder loads but PHP doesn't work properly. I get errors related to missing session folders and extensions. The problem is in php.ini file the paths are not absolute anymore. For example, in xampp 8.0 I had
session.save_path="C:\xampp\tmp"
In 8.2 I have
session.save_path="\xampp\tmp"
And same thing with extensions directory and all other paths defined in php.ini (and who knows where else). If I manually add C: to the path above, the sessions start working. I'm apprehensive of changing every path like that. Is there a better way to change the htdocs folder now?
I'm trying to create a new library using v 8.1.0 of the Angular Console on Windows. The error I get is "ENOENT: no such file or directory, mkdir "c:\path\to\my\workspace\libs\new_library_name"
"c:\path\to\my\workspace\libs" exists already
new_library_name folder should be created by Angular Console
The command run by the console is ng generate #nrwl/angular:library new_library_name.
I've tried different names/paths, running as administrator, running inside VSCode and in the standalone console. No luck with anything. This used to work.
Also, if I create the folder c:\path\to\my\workspace\libs\new_library_name and then run the console again, I get an error ENOENT: no such file or directory c:\path\to\my\workspace\libs\new_library_name\ReadMe.md. Of course the ReadMe doesn't exist - it needs to be created by the console.
What am I doing wrong or where to look?
Problem solved. I had turned on Controlled Folder Access in Windows 10 and mistakenly included my project folder as a controlled folder, which prevented applications (Angular Console, Yarn, etc) from writing to the folder. Removed it from Controlled Access and all is working again.
I am using VS Code to debug my Laravel project. I have installed the PHP Debug extension and configured PHP to debug using XDebug. Server is Apache (using Xampp). I am able to access my site using my browser, but the breakpoint I set inside my project using VS Code is never hit? What am I doing wrong here?
I am a completely new to VS Code, Laravel & XDebug. I personally battled to set breakpoints in VS Code so I could debug my Laravel project. I am posting this to try and help any other beginners out there who battled to set breakpoints in VS Code in order to debug a Laravel project.
Visual Studio Code + Xampp + XDebug Debugging:
Install VS Code
Install Xampp
In VS Code: Ctrl + J
Confirm PHP is installed: php -v
Install PHP Debug (Debug support for PHP with XDebug) extension in VS Code by clicking on Install
Use Xampp to get your php.ini information
Install XDebug:
1.1 Use XDebug Installation Wizard (https://xdebug.org/wizard.php) to generate dll needed.
1.2 Download generated dll XDebug file to: C:\xampp\php\ext
1.3 Configure PHP to use XDebug
-Go to Xampp and open php.ini file
-Add the following:
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
zend_extension = "C:\xampp\php\ext\php_xdebug-2.6.0-7.2-vc15.dll" (change this to your version of dll file)
1.4 Change default Xampp project directory:
-in Xampp Control Panel go to Apache config and select httpd.config
-in httpd.config go to "DocumentRoot" and change from "C:/xampp/htdocs" to a local folder where PHP projects are located.
-in httpd.config go to "DocumentRoot"'s "Directory" and change from "C:/xampp/htdocs" to same local folder where PHP projects are located.
example:
DocumentRoot "C:/xampp/htdocs"
Directory "C:/xampp/htdocs"
changed to:
DocumentRoot "C:/Users/..."
Directory "C:/Users/..."
In VS Code goto File --> Preferences --> Settings
Add the following:
php.validate.executablePath: "C:\xampp\php\php.exe"
To debug project in VS Code:
-First delete current launch.json file in .vscode
-Click on Debug --> Configure or Fix "launch.json" --> Select PHP (this will create a new launch.json file)
-In your browser, Goto localhost and open your website (project you want to debug)
-In VS Code, set a breakpoint in the file you want to debug (make sure it is in a PHP command section)
-In VS Code click on Debug --> "Listen for XDebug"
-In your browser refresh your website
-In VS Code your breakpoint should hit
I've got a fresh installation of Laravel Homestead based on this: https://laravel.com/docs/master/homestead
And a fresh new project using Laravel new.
I'm trying to run the example tests through PhpStorm's "Run configurations" but I get
vagrant:///Users/si/vagrant/Homestead/usr/bin/php /home/vagrant/.phpstorm_helpers/phpunit.php --no-configuration /home/vagrant/Code/homestead/tests
Testing started at 00:49 ...
Process finished with exit code 1
Cannot find PHPUnit in include path (.:/usr/share/php)
In the PhpStorm PHPUnit settings I have the PHPUnit library loaded with "Use custom autoloader" pointing at the composer autoload.php file like this:
/Users/si/Code/homestead/vendor/autoload.php
And composer has added the PHPUnit executable at
/Users/si/Code/homestead/vendor/bin/phpunit
I'm confused as to why PhpStorm can't find this PHPUnit executable when I'm telling it to use the composer autoload to find it.
OK, I fixed this. I had added a remote interpreter in the PHP settings, but was still using 'local' settings in the PHPUnit settings. I added a new PHPUnit settings configuration 'By Remote Interpreter' in the Languages and Framdworks > PHP > PHPUnit settings screen.
I selected 'Use custom autoloader' and specified the following:
/home/vagrant/Code/homestead/vendor/autoload.php
I've read other questions regarding this topic. The listed solutions haven't worked.
Installed:
XAMPP 1.7.7
Netbeans 7.1.1
XDebug 2.1.4
phpinfo() shows that Xdebug is installed with all the correct parameters:
zend_extension = C:\xampp\php\ext\php_xdebug-2.1.4-5.3-vc9.dll
xdebug.remote_enable = on
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000
However, when I start a Netbeans debug session, it cycles for awhile with no effect. When I stop it, I get the Info box informing me that "No connection from xdebug was detected with in nn seconds. The reasons could be that xdebug is not installed or not properly configured. (their emphasis).
As far as I can tell, I configured everything correctly, restarted the Apache server and it still doesn't work. I'm at a total loss on how to proceed. Any help is appreciated.
Can you believe it!? After spending literally HOURS researching this problem, I finally found the cause which I can only classify as a bug. Now, how do I report a bug? That's the next question.
Here's a summary:
create PHP project and setup NetBeans project site root to subfolder.
(In order to not register for Apache new test site for any new task I
put every new task into subfolder under my local test domain, e.g.
http://test.my/project3/ ). NetBeans will not start debugging session
automatically in this case. You will see a ‘waiting for connection’
message from the image below. Do not worry. Left it as it is. Go to
your browser. I use FireFox 4. And call the script you wish to debug
with additional parameter, e.g.
http://test.my/project3/index.php?XDEBUG_SESSION_START=netbeans-xdebug
When you return to NetBeans you will see that connection with xdebug
is established successfully. To stop XDebug session manually call any
script from the same subdirectory with this parameter
?XDEBUG_SESSION_STOP_NO_EXEC=netbeans-xdebug
The complete solution can be found on my newest hero's blog NetBeans 7.0 for PHP Waiting for Connection to XDebug
Edit: Know what I just discovered? I removed index.php as the index file of my run configuration. Works like a charm without having to manually insert the xdebug section of the url.
I just ran into this with Netbeans 8 and while your answer worked around my problem I think I found the solution that will fix it forever.
Project Properties => Run Configuration => Advanced ...
Ensure that the following entry is selected
Debug URL: 'Default: YOUR URL'
Mine was set to "Do Not Open Web Browser" .....
Now it works as it used to work many months ago :)
I am a .Net programmer and very new to PHP. Recently I was trying to host an open source PHP application on my machine(Windows). After the Struggle for 5-6 days I will list the steps which worked for me.
I uninstalled every previous installations of XAMPP and NetBeans and proceeded with fresh installations.
This might not be the solution for everyone but it worked for me and I hope it helps someone.
install XAMPP
install netbeans for PHP.
Open IIS and stop it. It is running on port 80 by default.(I am running XAMPP on port 80 i.e. default, Running on other port might need additional configuration settings)
Open XAMPP control panel and start Apache. If port 80 is free no problem should arise.
Open localhost in browser in should display XAMPP home page.
open phpinfo() link on the left pane and copy all the contents on page. Go to: http://xdebug.org/wizard.php and paste all the content in TextBox and click Analyze my phpinfo output. It will diplay you the Xdebug file suitable for your configuration.
Download the given Xdebug dll and copy it in C:\xampp\php\ext (Xampp being the default Xampp installation directory)
Goto XAMPP control panel, click on Config button in front of Apache and select php.in,
Find line similar or exacly like,
;zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
(Semicolon means it is commented)
Remove the semicolon and replace the path with the path of dll you just copied like:
zend_extension = "C:\xampp\php\ext\php_xdebug-2.3.2-5.4-vc9.dll"
Similarly find lines
;xdebug.remote_enable = 0 ;xdebug.remote_handler = "dbgp"
remove semicolons in front of both lines and make remote_enable = 1
xdebug.remote_enable = 1 xdebug.remote_handler = "dbgp"
Restart Apache server.
Copy your website code under C:/XAMPP/htdocs/(your_website)/ that means your index.php should be at C:/XAMPP/htdocs/(your_website)/index.php
Open Netbeans select New project -> PHP -> PHP project from existing source and select the folder you just copied in htdocs folder. Set it to run on Local web server.
Set a breakpoint on first line of index.php and debug.
That's it.
Additional settings were suggested on various different posts but above mentioned steps worked perfectly for me.
I think what you might be missing is
xdebug.idekey=netbeans-xdebug
this is the settings I use in my php.ini
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1 # Not safe for production servers
xdebug.remote_port=9000
xdebug.idekey=netbeans-xdebug
xdebug.remote_autostart=false
Read the installation of XAMPP 1.7.7 & Netbeans 7.1 with edditing
the php.ini file as suggested:
http://netbeans.org/kb/docs/php/configure-php-environment-windows.html
Create your PHP project in the local XAMPP directory, c:\xammp\htdocs\*yourproject*
Debug the index.php, you will see that your browser will start with additional parameters:
http://*yourproject*/index.php?XDEBUG_SESSION_START=netbeans-xdebug
Go to your Netbeans, your debugger will be started.