how can i associate/use PDT with eclipse in ubuntu?terr - php

I want to use PDT to debug PHP with eclipse. I am using ubuntu 9.04.
Can any one help me? please give details if possible.

Considering this thread and this one:
You have to ensure that xdebug is definitely loaded on the version of php you are using.
To do this, use the launch configuration you are using to try to run your script in debug mode and change it to run a script with phpinfo.php in it.
Also a Debug log would be good.
Add:
xdebug.remote_autostart=On
xdebug.remote_log="c:\temp\xdebug.log"
to your php.ini.
Then you have to insure that PDT is expecting Xdebug information on port 9000,
and have insured that your local Default PHP Web Server is http://127.0.0.1.
With the log, you might discover, for instance, that your php.ini files is not properly formatted, which could be enough to prevent you debugging PHP from PDT.

UYu would have to install PHP5 xdebug extension first,
sudo aptitude install php5-xdebug
after you would have to check your settings by editing /etc/php5/conf.d/xdebug
after you have to setup your php project to use xdebug and you should be done.

I'm use PDT in Ubuntu 9.04 and can fine debug my php projects.
first as already answered install php5-xdebug through apt-get or synaptic (I'm think you already install php5 itself in same way :) ). Then you must define php executables in Window/Preferenses/PHP/PHP Executables. You can point to /usr/bin/php, or can use 'Search...' button, but you must point initial search dir to nearest to your php exec binary. After found executable it always set to use Zend Debug by default. Edit executable to change 'PHP debugger' type to XDebug. And now a main trick. When you try debug your php scripts without create run configuration - it will always use Zend Debugger. You must create your own run configuration with XDebug setted as PHP Debugger. It's worked for me.

Related

Disable XDebug at runtime

I'm trying to run my Symfony website with XDebug, and PHP sockets at the same time.
To run the website:
bin/console server:start
To run the sockets
bin/console sockets:start
My sockets will not start unless XDebug is disabled.
However, I would like XDebug to be enabled for my website.
A solution is to disable XDebug system-wide in php.ini, but I would like to know if it is possible to do so at runtime, so I could unload XDebug before starting sockets when I run sockets:start.
Thank you!
To fix, before PHP 7 people would suggest to comment out the extension from php.ini file. However, in PHP 7 they are no longer in there.
Instead, we use the phpdismod command.
$ sudo phpdismod -s cli xdebug
The -s flag tells it to disable Xdebug for the CLI SAPI (/etc/php/7.0/cli) and not FPM.
And just like that, the warning message should be gone. No need to restart PHP
just assign two different ports for the debugger in the xdebug.ini (the CLI has it's own) -
because it sounds alike, as if it would get stuck due not being able to bind the port.
... this additional port then needs to be set up in the IDE, too.

PHP composer xdebug warning

New to PHP. Working on a PHP project and have xdebug enabled to be able to debug my php applications. The production server does not have xdebug enabled because it is handled by another team. On my local machine, when I run composer it gives me a warning saying
You are running composer with xdebug enabled. This has a major impact on
runtime performance.
I do not want to disable xdebug when I am developing. Just wanted to confirm that running xdebug in dev environment should have no impact on the composer installing libraries/performance of the app on the production server.
I do not want to disable xdebug when I am developing. Just wanted to confirm that running xdebug in dev environment should have no impact on the composer installing libraries/performance of the app on the production server.
There is a huge impact of just loading Xdebug. It slows the Composer run down by 3x or 4x, even when the profiling feature is not enabled.
In other words: xdebug is invaluable for debugging, but increases the memory used and processing time of Composer.
How to disable Xdebug for Composer runs?
My suggestion is to write a little invocation helper for running Composer.
The helper is a bash or batch script calling PHP with a custom php.ini, especially configured for Composer. Lets call it: php.ini-composer.
You could copy your current php.ini and adjust it for the Composer run, by removing xdebug or commenting it out, like so: ;zend_extension = "/path/to/my/xdebug.so".
While you are at it: setting memory_limit=-1 is helpful, too.
The full command looks like so on Windows: php.exe -c php.ini-composer composer.phar %*
Just clone the idea for a bash script.
And you may find the full answer to your question in the Composer FAQ.
https://getcomposer.org/doc/articles/troubleshooting.md#xdebug-impact-on-composer
It was added/updated just a few hours ago.
Some alternatives (instead of using seperate ini file) are also mentioned here.
Modern versions of Composer can work around having XDebug enabled by default for the CLI SAPI. It spawns a new PHP process with the XDebug extension disabled in case it is detected.
You can disable this behaviour by setting the following environment variable:
COMPOSER_ALLOW_XDEBUG=1
Found this in the documentation: https://getcomposer.org/doc/articles/troubleshooting.md#xdebug-impact-on-composer
Like with web scripts, expect CLI scripts to run slower as well.
If you need the added runtime performance, you can disable XDebug on CLI only. Set your PHP installation so that it uses different ini files for CLI and your server, as this answer suggests.
To fix this, prior to PHP 7 people would suggest to comment out the extension from your php.ini file.
However, in PHP 7 they are no longer in there.
Instead, we use the phpdismod command.
sudo phpdismod -s cli xdebug
The -s flag tells it to disable Xdebug for the CLI SAPI (/etc/php/7.0/cli) and not FPM.
And just like that, the warning message should be gone. No need to restart PHP.
In addition to this, there is a plugin that downloads packages in parallel to speed up the installation process.
Create a file named php-composer.ini somewhere with the following content (the minimum php config for composer):
extension_dir = "D:/php/ext/" ;according to your system
extension=php_openssl.dll
memory_limit=-1 ;optional
Now create a file named cmz.bat with the following contents. (edit paths accordingly)
#ECHO OFF
php -c "D:\php-composer.ini" "C:\ProgramData\ComposerSetup\bin\composer.phar" %*
add this file to your system path or your project root.
Now use cmz instead of composer and you will not see that message and hopefully the composer speed would be increased.
note: Some package need specific php extensions. you need to add them to php-compsoer.ini file or appending --ignore-platform-reqs switch to cmz.bat file
On a fresh download of Symfony 3.1 and PHP 7.0, you can run the following (having edited it to include the path to your composer.phar file):
php -n -d extension=json.so -d extension=phar.so -d extension=pdo.so -d extension=ctype.so /path/to/composer update
If you have any extra vendors to your composer.json file, you might find that they have a dependency on an extension, so you need to include that by adding -d extension=name_of_extension.so to the list.
What's happening here is the -n flag goes with PHP defaults - it doesn't load any ini PHP config files, so XDebug is never loaded. Then each of the -d flags allows you to dynamically set config values, so you can include extensions.

How to use Xdebug on the terminal?

I am trying to find a way to debug PHP other than var_dump() and I noticed Xdebug. I cannot find on the internet if Xdebug has a command-line version (I dont want to use a GUI version, bear with me(sshing another linux system)). If there is, how can I use it? If no, is there any other PHP debugging tools that can be run as command-line?
xdebug
Profiler:
With xdebug, you might run the profiler from CLI with this command:
php -d xdebug.profiler_enable=1 script.php
In order, to run this on the console, the box you are ssh'ing into must have PHP and Xdebug installed and configured.
Remote Xdebug:
Another option would be to use xdebug.remote_host with SSH tunneling/forwarding.
Forwarding is described here: http://derickrethans.nl/debugging-with-xdebug-and-firewalls.html
Remote Xdebugging here: http://xdebug.org/docs/remote
This allows to work with Netbeans or PHPStorm on the remote machine.
Xdebug's DebugClient
You might also use the simple DebugClient xdebug ships for CLI usage.
Every other debugging client, which supports the dbg-protocol, should work, too. http://xdebug.org/docs/install#debugclient
phpdbg
If you run PHP 5.6, then you might use phpdbg, which is the integrated debugger and perfect for CLI usage.

PHP Zend Debugger configuration

Hi i am new to php, I currently learning php using eclipse. I know i have to install the zend debugger my php.ini store at c:windows i had added in these line:
[Zend]
zend_extension=c:/php/ext/ZendDebugger.dll
zend_debugger.allow_hosts=127.0.0.1
zend_debugger.expose_remotely=always
zend_debugger.connector_port=10013
but on command prompt i tried php -m it shown that i never install zend debugger. I not sure where goes wrong I check phpinfo also never show any zend information.
I had lots of problems making the debugger work. Now I'm using the ZendServer CE which is free and the configuration is a lot easier.
Also I use Eclipse + PDT, downloaded from Zend Site.
This should work right out of the box. Why not using ZendServer? you get everything you want in a package.
On a browser go to:
http://localhost/?phpinfo=1
look for "Loaded Configuration File"
and take a note of the path
Now open a DOS prompt window (Start > Run > (type) cmd)
and at the command line type
c:\path\to\your\php\php.exe -r phpinfo(); |more
(press CTRL+C to break)
Again look for:
"Loaded Configuration File"
and take a note of this path.
It could be that you are using a different php.ini for your webserver and for the CLI version.
You will need to add the config changes to both php.ini files or put the config in a file called zend.ini and place that in the folder that is mentioned in your phpinfo output under:
"Scan this dir for additional .ini files"
I have experienced the same thing when I was using thread-safe PHP on Windows.
Up to date versions of the Zend Debugger no longer support running in thread-safe flavors of PHP on Windows. Switching to a non-thread-safe (a.k.a nts) flavor of PHP fixed this issue for me.
See here: http://forums.zend.com/viewtopic.php?f=59&t=1918#p13729

Can't install zend debugger

I'm trying to install zend debugger in my Ubuntu 9.04 machine, I've done it in win. but not in linux, I hope you could help me, this is what I've done:
1)Copied the file ZendDebugger.so to /etc/php5/apache2 (didn't choose this folder for anything in special).
2)Added this lines to php.ini:
zend_extension="/etc/php5/apache2/ZendDebugger.so" zend_debugger.allow_hosts=127.0.0.1,127.0.1.1,localhost,*
zend_debugger.expose_remotely=always
I've also tried without quotes(zend_extension=/etc/php5/apache2/ZendDebugger.so)
3)Copied file dummy.php to /var/www
And then restarted Apache but I didn't see the information about Zend Debugger in the phpinfo(), the only related thing I found there was report_zend_debug On.
Thanks in advance
I found much more easy to install Xdebug in my Ubuntu machine.
sudo mv /etc/php5/apache2/ZendDebugger.so /usr/lib/php5/20060613/ZendDebugger.so
This is where your memcache.so, apc.so, etc. are located. Unless you modified your php extensions directory that is where new exts should go.
In php.ini:
zend_extension=/usr/lib/php5/20060613/ZendDebugger.so
cd to that directory and chmod a-x ZendDebugger.so to remove executable bits from the .so.
sudo /etc/init.d/apache2 stop
In another terminal window, tail -f /var/log/error.log and clear console so it is easy to see new log entries coming in (cmd-k on macos).
Then:
sudo /etc/init.d/apache2 start
If there are no errors in error.log, check phpinfo() and see if the debugger section shows up.
You might get errors in the configuration of other php extensions that occur further up in php.ini (e.g., xcache or eaccellerator) that will make loading stuff further down in php.ini problematic.
This is a baseline setup and should work if there are no other problems.
You can also try to install Zend Server Community Edition
You'll get Zend Debugger enabled by default, along with some other nice features. There is a link to the deb repository available through the download page.
I followed the same steps that you did with the same result. In the end the problem was that I was trying to load a 32bit binary with apache running in 64bit mode base (as described in this post) I was able to get it running immediately by doing the following.
stopping apache
executing sudo arch -i386 /usr/sbin/httpd
restarting apache.
After replacing the 32bit binary with the 64bit binary everything worked as expected with no special apache handling. There was also some facepalming involved, but it did not affect the overall outcome.

Categories