PHPStrom is a great IDE. I really like it. But I bumped into an issue. I can't find instructions how to configure debugging for Yii console application.
I set debugging for Yii web application and it works fine.
Any help will be highly appreciated.
Upd1: Actually I figured out that there are 3 cases of the Yii console application.
Standard Yii console application (command files in the protected/commands folder of the webapp)
Standalone Yii console application (independent console aaplication without web application)
[My case] YiiBooster console application (YiiBooster has advanced, but good structure for medium or big projects)
After some period of time I found the solution. In my case it must be split in 2 parts:
Configure XDebug in PHPStorm
Get appropriate Xdebug version. Use this wizard from official xdebug site; just copy&past your phpinfo() response into window and it will tell you which version you must download.
Install it and make sure that XDebug is activated (phpinfo() must return xdebug section in the response). Use the following link for detailed instructions
Set XDebug as debugger for PHP in Project Settings
[The steps below are specific for Yii console application debugging]
Find yiic.php file in your project and Run or Debug it first time.
After this go Run->Edit Config and set name of your command in the arguments with required parameters.
Now set breakpoints in your code and activate "Listen debugger connections” button.
Debugging Yii command actions
If you want to use actions (like actionRebuildIndexes) in the command it needs to call the parent::run method in the run() function.
public function run($args) {
parent::run($args);
return 0;
}
For debugging it needs to specify the action name in the arguments for yiic.php Run Configuration (see image above)
There is article in jetbrains blog about it.
you just set your php.ini and add an parameter in xdebug like this:
xdebug.remote_autostart = 1
then you can debug your console application.
Related
Introduction
I've looked around and haven't seen anyone else having my issue.
Basically, I am wanting to run a start.bat file to start up my server before I start up my debugging session. I currently have my debugging inside of an IntelliJ Configuration and it works well. The problem is that in the options for my configuration I can't seem to add an "External Tools" task to the Before Launch section. I was able to add a maven task here previously. However, when I follow the following steps, the "start.bat" is not added.
First I go into Settings->Tools->External Tools to add my Spigot-Server tool which basically calls the start.bat file inside of a test-server directory.
Snippet of External Tools
Second, I go into my "Debug Spigot" configuration and at the bottom, I see a "Before Launch" Section.
Snippet of Spigot Debug options
I click on the + inside of that section to add a new task, and I click on "External Tools"
Snippet of adding External Tools Task
And then I make sure my Spigot-Server task is selected.
Snippet of select external tool
And then once I hit okay, the window closes but I don't see a new task added to the before launch section. It looks the same it did before I clicked on anything. I also don't see any status message at the bottom of IntelliJ
I basically expect the task "Spigot-Server" to show under the Before Launch section. This would basically start up the server and once the server was completely started, it would then launch the debugging configuration.
I think it may be an issue with IntelliJ's UI. I searched IntelliJ's issue tracker But couldn't find any that matched.
I'm wanting to know if there are any work arounds to get this setup in IntelliJ>
I was able to achieve my goal by doing some workarounds that I discovered with the help of CrazyCoder. I found this stackoverflow question that told me about the batch plugin.
I was able to create a Batch run configuration for a wrapper batch file that gets around the limitation CrazyCoder mentioned. He said that even if I did get my setup where my server runs before my debugging is launched, my debugging would never launch. This is because the terminal process needs to exit before the next task starts.
To get around this this is the wrapper batch file I created.
#echo OFF
START "Spigot-Server" /D C:\Users\rocke\Documents\Programming\Minecraft\Spigot\capture-the-carrot\test-server "start.bat"
ping -n 3 127.0.0.1 >nul
It basically uses the "START" command to run the task asynchronously and then waits 2 seconds. This is because all I need to do is wait for the start.bat command to run the very first part so that it establishes remote debugging. And then the wrapper ends after 2 seconds (the 3 represents the number of seconds I want to wait +1). And this allows the Debugging process to start while also ensuring that the server has setup remote debugging!
I'll just share screenshots of my configuration if anyone wants to do the same.
Maven Build Configuration
Spigot Server Start Configuration
Remote Debugging Configuration
The way this is setup is once I run the Remote Debugging Configuration, it has a "Before Launch" Task of Spigot Server. Spigot Server also has a "Before Launch" Task of Maven Build Project.
So my Maven Build Project runs, then my Spigot Server wrapper runs and after 2 seconds terminates, and then my Debugging Configuration runs!
If you have any questions regarding remote debugging with spigot, use this resource: https://www.spigotmc.org/wiki/intellij-debug-your-plugin/
Having the latest version 4.1.5 of ICXT for HCL Connections installed on WAS 8.5, I need to change some properties. The installation instructions said that we have a icxt-install.properties for installation, where we can set them. But it seems only possible during installation, not to change values which were already set.
How can I see what values are currently set and how to change them?
Backgrund
It's an ICXT installation without PDF export functionality, because this wasn't needed yet. But this has changed, so I want to enable it and develop some templates for our users. The selftest on https://cnxhost.internal/ic360/ui/selftest.html says
Is wkhtmltopdf installed? no
According to the documentation, I unpacked the binaries to ${CNX_SHARED_DIR}/icxt/pdfexport and restarted the WAS Appserver where ICXT is installed. But it's still not working. I assume that a predecessor admin or dev of mine changed this location, so I'd like to make sure that it points to my desired ${CNX_SHARED_DIR}/icxt/pdfexport path.
The script ${ICXT_INSTALL_DIR}/icxt-prepare.sh creates WebSphere Resource Entries. But just once during the installation. So we couldn't change the properties and re-run the script, as I assumed. To change it, open WebSpheres ISC web console and navigate through Resources > Resource Environment > Resource Environment entries
Now click in ic360
and Custom properties
Now you see a list of all the properties which were set by the installer. If some values were wrong (in my case wkhtmltopdf.command.exec), click on the entry and change the value field.
After conforming with OK and save, we need to restart the Appserver where ICXT is hosted in. If you don't know, look at the WebSphere enterprise applications, open any IC360 app and look in Manage Modules. In my case its CustomApps, which we can restart in Server > WebSphere Applicationserver.
Now reload the self test page and we see the wiki module check working fine:
I am using the latest (2014-01-03) Golang plugin for IntelliJ - for the first time.
Usually, my terminal workflow is to do go build && ./executable -args=1
So I am attempting to create a launch configuration to do the same thing, I took these actions:
Create a "Go Application" configuration
Fill in GOPATH/GOROOT environment variable
Fill in CLI arguments
Because there has to be a file to run, so I chose the one with func main()
Then there is a problem. When I run the configuration, the Golang plugin does not build the project, but instead builds the single script file with main method, then attempt to run it - obviously it does not work.
How to create a configuration equivelent of go build && ./executable -args=1?
Try to use the latest version from the official plugin manager.
If that doesn't work, please help us identify the issue by submitting a report here
Also, we are working hard to update the plugin with better type checks, debugging, go appengine support, improved formatter and much more but any help in improving the plugin is greatly appreciated.
Hope it helps.
However, I prefer to use goclipse which support auto-build, auto code completion and debug.
I have some idea with error handling in PHP - way to immediately get to place in code where error occurred.
I have written error handler to catch PHP errors, which loads file, that caused an error and displays +/- few lines of code from that file. It also mark line where error occurred and print stack trace, like this:
http://img834.imageshack.us/img834/3754/errh.png
Now, I have an idea, to provide some link (a href=) like other than http protocols (torrent:// or sth), like "netbeans://C:/some/file.php#110" which will put me back into NetBeans editor, open file where error occurred and put cursor in line, which caused a error.
Any ideas how to achieve that goal ?
What you need to do is register a custom url protocol. The techniques depend on the underlying operating system. here's is an example for windows. By opening NetBeans with a system call and the --open [filename] argument, you can open the file in question. However, that way you won't be able to go to a specific line.
In order to do so, you need to use the NetBeans API. If needed, you can use JNBridge to access Java functionality from .NET languages (which you'd need for windows).
All in all, it won't be easy and not cross-platform. A much easier way to go is to use xDebug on the server side and implement the library in the NetBeans editor, which will allow a lot more functionality than what you currently try to accomplish (stack traces, Jumping in Code, Stepping, variable views, ... - just to name a few). There seems to be a started proposal on this for the NetBeans editor.
If you do not care to switch the editor, you can check out Eclipse PHP Development Tools (Eclipse PDT), which has the debugger already implemented. Check out this article on the setup instructions.
I'd use xDebug with Netbean's xdebug integration which already jumps to the errors.
NetBeans IDE already has this option
Please open your project in NetBeans IDE.
main menu -> options -> editor -> hints -> select language php & select all check-boxes.
then refresh project show highlighting errors or undefined variables warnings.
if more with NetBeans IDE
http://netbeans.org/kb/docs/php/editorguide.html
i'm still new to yii framework.
so, i want to try running yiic so that i could see the structure of the files created.
but, i could not run it in console. Does anyone have a solution? thanks.
I'm using wamp on win xp.
i go to the directory of the yiic framework
its in D:\wamp\www\framework\
and run yiic and any other variations per Larry Ullman's blog. but still got: "..." is not a recognizable internal/ external command...
How should i be able to run yiic? thanks.
just read this:
http://www.yiiframework.com/doc/cookbook/3/
:)
It's always better to follow yii official documentation.
You can find Installing Yii process step by step here
documentation> tutorial > The Yii Blog Tutorial > Testdriving with
Yii # Installing Yii
here is the link http://www.yiiframework.com/doc/blog/1.1/en/start.testdrive#installing-yii
If you getting this kind of error when you try to use yiic webapp ..\app-name
'"php.exe"' is not recognized as an internal or external command,
operable program or batch file.
Open the yiic.bat file under yii framework folder ( C:\wamp\www\framework ) and change the bellow line
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
to
if "%PHP_COMMAND%" == "" set PHP_COMMAND=C:\wamp\bin\php\php5.4.16\php.exe
php5.4.16 this might be change accroding to you php version, please check in C:\wamp\bin\php folder before change
Cheers