Using inclued php pecl extension - php

I'm currently trying to level up on my PHP debugging skills and as part of that I'm trying to learn several new tools. One of them is inclued.
The extension seemingly works fine (no startup error, shows up in phpinfo, generates dump files), but it always reports number of includes as 0, so something is clearly not working right.
At first I suspected this was related to my heavy use of auto_include, but after doing some tests which do not, I doubt that is related.
Class graphs are generated OK, but include maps simply don't exist. Am I simply Doing It Wrong, or is the extension broken? I just don't know and even after some heavy duty googling cannot find anything useful.
I installed inclued using the "phpize method". My PHP version is 5.3.2 running on Mac OSX 10.6.5. I also have XDebug and memtrack installed.

After doing a test run with valgrind watching Apache I noticed xdebug was operating below inclued. On a blind test I tried disabling XDebug and lo and behold: inclued works as expected.
So to answer my own question:
Don't use XDebug in conjunction with inclued if you want to have include graphs. Class graphing works fine with XDebug running.

Related

Installing one PHP extension for a program on Windows

sorry if I seem like an absolute beginner at these things. I wanted to get the PHP extension for GEOS. I already have PHP (though XAMPP) and GEOS installed. Now, trying out the instructions on GitHub, I soon realize that these are instructions for Linux. I've been googling instructions for getting PHP extensions in Windows, but I've learned that it's not quite simple. Based on what I've found I would either need to
Use Visual Studio (which I would have to download first)
Find a dll (there is none)
Recompile PHP with the extension (not sure if I said it right)
So I have two questions: firstly, which of these options are most suitable for getting just one extension? And secondly, regarding the recompiling option, would I have compile things from a different source, since I got PHP from XAMPP and it doesn't seem to have the option to install the components separately.
EDIT: I believe that my question is not the same as this one because the user here actually found relevant DLLs, and did not have to compile anything or use Visual Studio.

Defeated trying to install mongodb PHP extension on MAMP

I've done all the things suggested by other answers to this question (or at least I think I have), but I'm still completely stuck.
The specific problem going on at the moment is that the compiler can't find zend_config.h. I have PHP 5.5.10, which came with my out-of-the-box MAMP install. My first attempts were failing because the compiler couldn't find php.h. It seems that I need the PHP source code in order to build the mongo driver. A surprise to me (perhaps I'm too much of a n00b), but ok.
Unfortunately, I could not find the source for 5.5.10, only 5.5.14. Who knows whether that's what I really need. Out of desperation, I copied the main and Zend folders from 5.5.14 to my 5.5.10 folder. So I have php.h, but now no zend_config.h. There are zend_config.w32.h and zend_config.nw under the Zend folder. I guess I could take a desperate measure again and try renaming one of these files to see whether the extension will build, but I'd rather hear from someone who knows what they're doing.
Other answers to this kind of question say that you need the XCode command-line tools. I'm running Mavericks, so I got the command-line tools for Mavericks. I have XCode 5.1.1; I realize that it's up to V6 now, but do I really need the latest version of XCode for this? The installation of MongoDB itself using homebrew was beautifully uneventful. I got the mongo extension source from github and I'm following the very brief instructions from that repo.
I'm amazed that installing a simple extension would be this hard. I sure hope mongodb is enough of a performance improvement to justify this much headache. Can anyone give me an idea of how to get this going?
I had this same issue. It might be the fact that MAMP uses it's own .ini file and seems to ignore the .ini file in it's own PHP conf folder.
Once i updated MAMP's own .ini file (stored in /Applications/MAMP etc...).
Check your phpInfo page and look for the following:
Loaded Configuration File: /Library/Application Support/appsolute/MAMP PRO/conf/php.ini

php, xampp and debug - can't get to work

I know this question has been asked before and I've looked through the responses but no matter what I do, I can't create an environment to step through my php programs.
I've downloaded the XAMPP stack, and Eclipse and enabled xdebug but nothing.
PHPinfo reports: Debug Build, No.
Does that mean that I'll never get an XAMPP installation to debug. If so is there another Windows, Apache, PHP, MySQL stack recommended?
I downloaded the Komodo IDE 21 day free trial and their wizard can't start debug either.
help
No, the Debug Build phpinfo() refers to is a compile-time switch/define that affects the way php itself is compiled. The debug build is less optimized, contains some more test code and the symbol files, used when stepping through the php C code with a debugger, are more accurate (mostly due to the less optimized code).
It does not affect the ability to add a script debugger module like xdebug. But you need a version of the module .dll/.so that is compatible with your version of php. The API version, Thread-safety "enabled/disabled" and "debug yes/no" information must match. (on second thought I'm not even sure if debug yes/no must match).
Does the xdebug section appear in the output of phpinfo()? If not make sure you've edited the right php.ini. In recent versions of xampp that should be <xampp dir>/php/php.ini regardless of whether you use php-cli or the apache module. But it used to be <xampp dir>/php/php.ini for the cli version but <xampp dir>/apache/bin/php.ini for the apache module of php.
Also check the error.log in <xampp dir>/apache/logs for error messages that might be related. Those should begin with "PHP Startup: ....error message..."
try using wamp if your using windows. It works great for me

Will PHPUnit and XDebug work together?

I've been working on writing unit tests for my PHP code. PHPUnit is what I'm using for this.
I have some classes that work great until...
I throw XDebug into the mix.
At that point, PHPUnit doesn't crash or anything, but setExpectedException never triggers.
In fact, the code never goes beyond that point.
Anyone run across this and know what the solution is?
Edit: This is with the PHP5.2.6, Latest versions of XUnit and XDebug. This is on linux fedora 7
I've had some problems before with one combination of Xdebug & PHPUnit (as did others, from a report I say on devzone.zend.com at the time), but that was a while ago. PHPUnit does explicitly support Xdebug though - and I'm using it to produce code coverage reports for my own systems.
I'd suggest the fairly standard debugging techniques, updating any versions you can (maybe even PHP?) commenting out the #setExpectedException, or throwing it explicitly - and of course, making sure that you have full warnings and errors being shown with error_reporting(E_ALL|E_STRICT); set on.
Don't forget to stop and restart the Apache server to make sure that the Xdebug module is loaded as well.

Is there a interactive debugger for php like ruby's debugger?

I watched the Creating a weblog in 15 minutes with Rails 2 and after 9 minutes in the video he shows ruby's interactive debugger, which allows you to call functions/methods from within a running script.
This goes way beyond breakpoints and looks very useful.
Is there something for PHP that gives similar functionality?
Install xdebug and then use one of the debug clients mentioned here.
Although Milen's answer is the only correct one circa 2009, and Xdebug is still a useful tool, using it requires you to recompile your PHP or to edit your php.ini runtime configuration to load it as a shared object. It also means using a specific client application that supports its network protocol, such as an IDE like PhpStorm.
An alternative is phpdbg, which is an interactive debugger that ships with PHP core versions 5.6 and later and can debug PHP scripts written to conform to PHP 5.4 or later.
Using it is simple:
phpdbg php_script_i_want_to_debug.php
Once in the debugger, type help to access the help menu.
If you don't already have phpdbg on your system, it may be because your PHP was configured without the --enable-phpdbg option. You can either:
Recompile your PHP, being sure to add --enable-phpdbg when you run ./configure (this will simply also build the phpdbg binary), or
download the phpdbg source independently and compile it against your installed PHP (assuming you have the PHP source available). Instructions for doing that, while sparse, are here.

Categories