How to disable XDebug - php

I think that my server became slow since I installed XDebug.
So, in order to test my hypothesis I want to disable XDebug completely.
I've been searching for tutorials on how to do this but I can't find such information.

Find your php.ini and look for XDebug.
Set xdebug autostart to false
xdebug.remote_autostart=0
xdebug.remote_enable=0
Disable your profiler
xdebug.profiler_enable=0
Note that there can be a performance loss even with xdebug disabled but loaded. To disable loading of the extension itself, you need to comment it in your php.ini. Find an entry looking like this:
zend_extension = "/path/to/php_xdebug.dll"
and put a ; to comment it, e.g. ;zend_extension = ….
Check out this post XDebug, how to disable remote debugging for single .php file?

An easy solution working on Linux distributions similar to Ubuntu
sudo php5dismod xdebug
sudo service apache2 restart

In Linux Ubuntu(maybe also another - it's not tested) distribution with PHP 5 on board, you can use:
sudo php5dismod xdebug
And with PHP 7
sudo phpdismod xdebug
And after that, please restart the server:
sudo service apache2 restart

Also, you can add xdebug_disable() to your code. Try:
if(function_exists('xdebug_disable')) { xdebug_disable(); }

I renamed the config file and restarted server:
$ mv /etc/php/7.0/fpm/conf.d/20-xdebug.ini /etc/php/7.0/fpm/conf.d/20-xdebug.ini.bak
$ sudo service php7.0-fpm restart && sudo service nginx restart
It did work for me.

Comment extension in php.ini and restart Apache. Here is a simple script (you can assign shortcut to it)
xdebug-toggle.php
define('PATH_TO_PHP_INI', 'c:/xampp/php/php.ini');
define('PATH_TO_HTTPD', 'c:/xampp/apache/bin/httpd.exe');
define('REXP_EXTENSION', '(zend_extension\s*=.*?php_xdebug)');
$s = file_get_contents(PATH_TO_PHP_INI);
$replaced = preg_replace('/;' . REXP_EXTENSION . '/', '$1', $s);
$isOn = $replaced != $s;
if (!$isOn) {
$replaced = preg_replace('/' . REXP_EXTENSION . '/', ';$1', $s);
}
echo 'xdebug is ' . ($isOn ? 'ON' : 'OFF') . " now. Restarting apache...\n\n";
file_put_contents(PATH_TO_PHP_INI, $replaced);
passthru(PATH_TO_HTTPD . ' -k restart');

in xubuntu I totally disabled xdebug for the CLI with this...
sudo rm /etc/php5/cli/conf.d/*xdebug*

On Windows (WAMP) in CLI ini file:
X:\wamp\bin\php\php5.x.xx\php.ini
comment line
; XDEBUG Extension
;zend_extension = "X:/wamp/bin/php/php5.x.xx/zend_ext/php_xdebug-xxxxxx.dll"
Apache will process xdebug, and composer will not.

If you are using php-fpm the following should be sufficient:
sudo phpdismod xdebug
sudo service php-fpm restart
Notice, that you will need to tweak this depending on your php version. For instance running php 7.0 you would do:
sudo phpdismod xdebug
sudo service php7.0-fpm restart
Since, you are running php-fpm there should be no need to restart the actual webserver. In any case if you don't use fpm then you could simply restart your webserver using any of the below commands:
sudo service apache2 restart
sudo apache2ctl restart

Ubuntu 16.04 remove xdebug from PHP.
Find your php.ini file and make sure xdebug is there:
grep -r "xdebug" /etc/php/
This might come up with different versions, if so run php -v to find your version.
Edit the php.ini file, like:
sudo vi /etc/php/5.6/mods-available/xdebug.ini
Comment the line:
//zend_extension=xdebug.so
Save the file

Inspired by PHPStorm right click on a file -> debug -> ...
www-data#3bd1617787db:~/symfony$
php
-dxdebug.remote_enable=0
-dxdebug.remote_autostart=0
-dxdebug.default_enable=0
-dxdebug.profiler_enable=0
test.php
the important stuff is -dxdebug.remote_enable=0 -dxdebug.default_enable=0

Two options:
1: Add following code in the initialization Script:
if (function_exists('xdebug_disable')) {
xdebug_disable();
}
2: Add following flag to php.ini
xdebug.remote_autostart=0
xdebug.remote_enable=0
1st option is recommended.

Find your PHP.ini and look for XDebug.
normally in Ubuntu its path is
/etc/php5/apache2/php.ini
Make following changes (Better to just comment them by adding ; at the beginning )
xdebug.remote_autostart=0
xdebug.remote_enable=0
xdebug.profiler_enable=0
then restart your server
again for Ubuntu
sudo service apache2 restart

Disable xdebug
For PHP 7: sudo nano /etc/php/7.0/cli/conf.d/20-xdebug.ini
For PHP 5: sudo nano /etc/php5/cli/conf.d/20-xdebug.ini
Then comment out everything and save.
UPDATE -- Disable for CLI only
As per #igoemon's comment, this is a better method:
PHP 7.0 (NGINX)
sudo mv /etc/php/7.0/cli/conf.d/20-xdebug.ini /etc/php/7.0/cli/conf.d/20-xdebug.ini.old
sudo service nginx restart
Note: Update the path to your version of PHP.

I created this bash script for toggling xdebug. I think it should work at least on Ubuntu / Debian. This is for PHP7+. For PHP5 use php5dismod / php5enmod.
#!/bin/bash
#
# Toggles xdebug
#
if [ ! -z $(php -m | grep "xdebug") ] ; then
phpdismod xdebug
echo "xdebug is now disabled"
else
phpenmod xdebug
echo "xdebug is now enabled"
fi
# exit success
exit 0

I ran into a similar issue. Sometimes, you wont find xdebug.so in php.ini. In which case, execute phpinfo() in a php file and check for Additional .ini files parsed. Here you'll see more ini files. One of these will be xdebug's ini file. Just remove (or rename) this file, restart apache, and this extension will be removed.

I had following Problem:
Even if I set
xdebug.remote_enable=0
Xdebug-Error-Message-Decoration was shown.
My solution:
xdebug.default_enable=0
Only if I use this Flag, Xdebug was disabled.

(This is for CentOS)
Rename the config file and restart apache.
sudo mv /etc/php.d/xdebug.ini /etc/php.d/xdebug.ini.old
sudo service httpd restart
Do the reverse to re-enable.

Since xdebug 3 came out the settings in pnp.ini have slightly changed.
Setting:
xdebug.mode=off
Will disable all processing According to the docs:
Nothing is enabled. Xdebug does no work besides checking whether
functionality is enabled. Use this setting if you want close to 0
overhead.

Disable xdebug only for certain PHP version or sapi.
On this case PHP 7.2 fpm
sudo phpdismod -v 7.2 -s fpm xdebug
sudo service php7.2-fpm nginx restart

You can disable Xdebug on PHP CLI on runtime using the -d flag:
php -d xdebug.mode=off -i | grep xdebug.mode
Result: xdebug.mode => off => off
Example, running unit tests with Xdebug disabled, so it's faster:
php -d xdebug.mode=off ./vendor/bin/phpunit
You can also create an alias for it to make it easier to use.

If you are using MAMP Pro on Mac OS X it's done via the MAMP client by unchecking Activate Xdebug under the PHP tab:

So, yeah, all what you need, just comment line in INI file like zend_extension=xdebug.so or similar.
Comments can be made by adding semicolon.
But, such kind of answer already added, and I'd like to share ready solution to switch Xdebug status.
I've made quick switcher for Xdebug. Maybe it would be useful for someone.
Xdebug Switcher

For WAMP, click left click on the Wamp icon in the taskbar tray. Hover over PHP and then click on php.ini and open it in your texteditor.
Now, search for the phrase 'zend_extension' and add ; (semicolon) in front it.
Restart the WAMP and you are good to go.

Apache/2.4.33 (Win64) PHP/7.2.4 myHomeBrew stack
At end of php.ini I use the following to manage Xdebug for use with PhpStorm
; jch ~ Sweet analizer at https://xdebug.org/wizard.php for matching xdebug to php version.
; jch ~ When upgrading php versions check if newer xdebug.dll is needed in ext directory.
; jch Renamed... zend_extension = E:\x64Stack\PHP\php7.2.4\ext\php_xdebug-2.6.0-7.2-vc15-x86_64.dll
zend_extension = E:\x64Stack\PHP\php7.2.4\ext\php_xdebug.dll
; jch !!!! Added the following for Xdebug with PhpStorm
[Xdebug]
; zend_extension=<full_path_to_xdebug_extension>
; xdebug.remote_host=<the host where PhpStorm is running (e.g. localhost)>
; xdebug.remote_port=<the port to which Xdebug tries to connect on the host where PhpStorm is running (default 9000)>
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_dir="E:\x64Stack\Xdebug_profiler_output"
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=1
; jch ~~~~~~~~~To turn Xdebug off(disable) uncomment the following 3 lines restart Apache~~~~~~~~~
;xdebug.remote_autostart=0
;xdebug.remote_enable=0
;xdebug.profiler_enable=0
; !!! Might get a little more speed by also commenting out this line above...
;;; zend_extension = E:\x64Stack\PHP\php7.2.4\ext\php_xdebug.dll
; so that Xdebug is both disabled AND not loaded

For those interested in disabling it in codeship, run this script before running tests:
rm -f /home/rof/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
I was receiving this error:
Use of undefined constant XDEBUG_CC_UNUSED - assumed 'XDEBUG_CC_UNUSED' (this will throw an Error in a future version of PHP)
which is now gone!

In CLI:
sudo phpdismod xdebug
disable xdebug
sudo phpenmod xdebug
enable xdebug
And restart the server

Related

PHP exec doesn't work when mysqli call is included [duplicate]

I have looked through all of the forums that I could find relevant to this question and my problem yet nothing works. I have apache2.2 with php5, phpMyAdmin, and MySQL. I have uncommented the extension, I have checked my phpinfo() and mysqli does not come up. My config directory is where it should be and it still will not load.
Find out which php.ini is used.
In file php.ini this line:
extension=mysqli
Replace by:
extension="C:\php\ext\php_mysqli.dll"
Restart apache
If your configuration files are okay but still having the same issue then install php7.x-mysql according to the version of the installed php.
For example in my case, I'm using php7.3 so I ran the following command to get it all set:
sudo apt install php7.3-mysql
systemctl reload apache2
I know this is a while ago but I encountered this and followed the other answers here but to no avail, I found the solution via this question (Stackoverflow Question)
Essentially just needed to edit the php.ini file (mine was found at c:\xampp\php\php.ini) and uncomment these lines...
;extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_pdo_mysql.dll
After restarting apache all was working as expected.
In your Xampp folder, open php.ini file inside the PHP folder i.e xampp\php\php.ini (with a text editor).
Search for extension=mysqli (Ctrl+F), if there are two, look for the one that has been uncommented (without ";" behind)
Change the mysqli with the correct path address i.e extension=C:\xampp\php\ext\php_mysqli.dll.
On your Xampp control panel, stop and start apache and MySQL
sudo apt-get install php7.2-mysql
extension=mysqli.so (add this php.ini file)
sudo service apahce2 restart
Please use above commands to resolve mysqli-extension missing error
This article can help you Configuring PHP with MySQL for Apache 2 or IIS in Windows. Look at the section "Configure PHP and MySQL under Apache 2", point 3:
extension_dir = "c:\php\extensions" ; FOR PHP 4 ONLY
extension_dir = "c:\php\ext" ; FOR PHP 5 ONLY
You must uncomment extension_dir param line and set it to absolute path to the PHP extensions directory.
Copy libmysql.dll from the PHP installation folder to the windows folder.
I've been searching for hours and no one could help me. I did a
simple thing to solve this problem. (WINDOWS 10 x64)
Follow this:
1 - Go to your php_mysqli.dll path (in my case: C:/xampp/php/ext);
2 - Move the php_mysqli.dll to the previous folder (C:/xampp/php);
3 - Open php.ini and search the line: "extension: php_mysqli.dll";
4 - Change to the path where is your file: extension="C:\xampp\php\php_mysqli.dll";
5 - Restart your application (wampp, xampp, etc.) and start Apache Server;
The problem was the path ext/php_mysqli.dll, I've tried changing the line to extension="C:\xampp\php\ext\php_mysqli.dll" but doesn't worked.
Simply specify the directory in which the loadable extensions (modules) reside in the php.ini file from
; On windows:
extension_dir="C:\xampp\php\ext"
to
; On windows:
;extension_dir = "ext"
Then enable the extension if it was disabled by changing
;extension=mysqli
to
extension=mysqli
I had the same problem and I solved it. You can solve it too if you follow these steps:
you have to install PHP to C:/php
or your current version locate it to this path and specify it as a system variable
then open xampp program and click config and open php.ini
and uncomment the following lines:
extension=pdo_mysql
extension=pdo_mysql
extension=openssl
I encountered this problem today and eventually I realize it was the comment on the line before the mysql dll's that was causing the problem.
This is what you should have in php.ini by default for PHP 5.5.16:
;extension=php_exif.dll Must be after mbstring as it depends on it
;extension=php_mysql.dll
;extension=php_mysqli.dll
Besides removing the semi-colons, you also need to delete the line of comment that came after php_exif.dll. This leaves you with
extension=php_exif.dll
extension=php_mysql.dll
extension=php_mysqli.dll
This solves the problem in my case.
I simply copied my php_myslqli.dll file from ert folder back to php folder, and it worked for me after restarting my Apache and MySQL from the control Panel
Its an issue of extension directory. You need to change php extension directory manually to work this.
If you are using AMPP Server, do the following
Goto settings -> PHP -> Configuration
in php7.3.ini Find, (Versions might change)
extension_dir = "" , (Already having some path)
and change value to
extension_dir = "C:\Program Files\Ampps\php-7.3\ext"
If you are using XAMP
Goto XAMP Settings, Apache -> PHP.ini
Find, extension_dir = in php.ini, and set path of the php extension folder of your local machine. See the below example.
extension_dir = "C:\php\ext" (Check your path properly)
In my case, I had a similar issue after full installation of Debian 10.
Commandline:
php -v show I am using php7.4 but print phpinfo() gives me php7.3
Solution: Disable php7.3 Enable php7.4
$ a2dismod php7.3
$ a2enmod php7.4
$ update-alternatives --set php /usr/bin/php7.4
$ update-alternatives --set phar /usr/bin/phar7.4
$ update-alternatives --set phar.phar /usr/bin/phar.phar7.4
$ update-alternatives --set phpize /usr/bin/phpize7.4
$ update-alternatives --set php-config /usr/bin/php-config7.4
Replace
include_path=C:\Program Files (x86)\xampp\php\PEAR
with following
include_path="C:\Program Files (x86)\xampp\php\PEAR"
i.e Add commas , i checked apache error logs it was showing syntax error so checked whole file for syntax errors.
The thing that fixed my problem is: open php.ini then add this extension=php_mysqli.dll
try to change PHP version
$sudo update-alternatives --config php
if it didn't work
change for example from PHP 5.6 => PHP 7.1
$ sudo a2dismod php5.6
$ sudo a2enmod php7.1
$ sudo service apache2 restart

Xdebug not working after I install PHP and configure settings

I installed Xdebug on PHP 7.3 using pecl install xdebug
When I add these settings to /etc/php/7.3/apache2/php.ini and reload Apache the page fails and says no data sent to server.
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
zend_extension="/usr/lib/php/20180731/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.halt_level=E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE
xdebug.scream=1
Not sure why it's not working.
(In the original version of your question, your configuration was commented out, now you've edited that bit out, leaving the next couple of paragraphs kinda out of the loop)
Despite the documentation stating that the has character (#) is no longer recognized as a valid comment character since PHP 7.0:
it seems that php will happily treat those lines as commented nonetheless in configuration files. Everything afer the hash is ignored by the interpreter.
So those configuration lines are completely ineffective.
To verify that your configuration is being loaded, create a simple file like this:
<php
phpinfo();
Loading this file will tell you everything about PHPs configuration. If Xdebug has been successfully loaded, you'll see something like this:
And down below the configuration settings loaded:
These are the most important settings, that actually load and enable the Xdebug extension:
zend_extension="/usr/lib/php/20180731/xdebug.so"
xdebug.remote_enable=1
Important: You need to check that /usr/lib/php/20180731/xdebug.so actually exists, and if not find the actual location of your xdebug module.
The next line assumes that the webserver and the browser are installed on the same machine on the same IP, which might be true for a simple setup:
xdebug.remote_host=127.0.0.1
As an alternative, you can tell Xdebug to connect back to whichever IP has made the orginal request
xdebug.remote_connect_back=On
With the following line you are telling on which port your IDE is listening to. It's 9000 by default, so you'll normally would not need to set it unless you need to listen to a non-standard port (e.g. debugging several projects at the same time, against different interpreters). But normally, you can omit this line safely:
xdebug.remote_port=9000
Once the module is loaded and enabled, you can also configure some Xdebug settings using an environment variable. Specifically xdebug.remote_host, xdebug.remote_port, xdebug.remote_mode and xdebug.remote_handler
E.g:
export XDEBUG_CONFIG="remote_host=192.168.0.3 remote_port=9005"
xdebug is not compatible with php7.3 for releases < 2.7
you may install xdebug beta version which is make-compatible with php7.3:
pecl install xdebug-beta
https://bugs.xdebug.org/view.php?id=1584
Update:
XDEBUG has released a new version, and it has different configurations. The new version is compatible with PHP>=7.4. Check it out:
https://xdebug.org/docs/install
To install xdebug on php7.3 run the following commands:
sudo update-alternatives --set phpize /usr/bin/phpize7.3
sudo update-alternatives --set php /usr/bin/php7.3
sudo update-alternatives --set php-config /usr/bin/php-config7.3
Now download source code and install by running the following commands:
cd /tmp
wget http://xdebug.org/files/xdebug-2.8.0.tgz
tar -xzvf xdebug-2.8.0.tgz
cd xdebug-2.8.0
phpize
./configure
sudo make
sudo make install

Change apache2 php path

I am using https://github.com/wilmoore/php-version to switch between php versions on my local machine, installed within ~/php/versions. Currently setting up separate VMs with different versions of php installed is not an option.
When I switch php version through the command line using the linked tool, I see it listed as php 7. This also works when using php -v. I have restarted terminal and the machine and it still says php 7.
I have updated composer.json to require php 7.0.2 and greater. Yet when I use phpinfo() in my laravel application, it always states the default PHP Version 5.5.9-1ubuntu4.14.
Where is laravel pointing to the php distribution in my Ubuntu 14.04.3 machine and where can I change this path?
EDIT: I am using Apache. I can see in the phpinfo() output that it is reading the ini file from /etc/php5/apache2/php.ini. I have looked in this file but cannot see where to point to the php distribution.
first make sure that php7.*.conf and php7.*.load files are exist in /etc/apache2/mods-available directory.
then use sudo a2enmod php7.* to enable the mod
use sudo a2dismod php5.* to disable the mod
after running the two commands restart your apache2 server
using sudo systemctl restart apache2
The Apache loads the php5_module library in /etc/apache2/mods-available/php5.load.
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
If you know the loactions of your alternative libraries you can change them in this file.
After editing you need to restart your apache. sudo service apache2 restart or sudo systemctl restart apache2.service
Had the same issue on ubuntu16.
ls -l /etc/apache2/mods-available/php7* ,
showed 2 versions -
/etc/apache2/mods-available/php7.0.conf
/etc/apache2/mods-available/php7.2.conf
Deleted the /etc/apache2/mods-available/php7.0.conf, restarted apache2, and phpinfo() via apache2 showed php7.2

xdebug not working after ubuntu upgrade

today I upgraded ubuntu 14.10 to 15.04 and xdebug is not working anymore. I use eclipse Luna Service Release 2.
I've tried reinstalling xdebug through pecl, apt-get, even manual install following http://xdebug.org/wizard.php instructions (pasting my phpinfo() output).
I have xampp, in /opt/lampp directory.
I've tried several locations for "zend_extension" in /opt/lampp/etc/php.ini such as zend_extension=/usr/lib/php5/20131226/xdebug.so and zend_extension =/opt/lampp/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
When I hit debug on eclipse, the browser receives the order, and the parameters ?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY= are included in the url, but the execution will not stop on any breakpoint.
When I run phpinfo() xdebug is not showing as an installed module.
any hints?
I removed the phpinfo() output for clarification after posting the answer.
Finally I found no solution, so I had to remove all the lamp package, and I reinstalled everything as independent modules following this tutorial: http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/, then I did this to install xdebug:
1.- Install xdebug extension for PHP
$ sudo apt-get install php5-xdebug
2.- Check the location of "xdebug.so" module, which is kept under "/usr/lib/php5/20131226", where the number depends on the PHP version.
3.- The installation creates a configuration file "/etc/php5/mods-available/xdebug.ini" with the following line (otherwise, create one):
zend_extension=xdebug.so
NOTE: in the previous version, you need to specify the full-path filename, e.g., "zend_extension=/usr/lib/php5/20121212/xdebug.so".
Include the following lines into "xdebug.ini" to enable remote debugging from Eclipse PDT:
xdebug.remote_enable = On
xdebug.remote_port = 9000
xdebug.remote_host = 127.0.0.1
Recall that Apache loads PHP configuration files "/etc/php5/apache2/php.ini" and "/etc/php5/apache2/conf.d/*.ini". To enable the above xdebug configuration file, create the following symlink in "/etc/php5/apache2/conf.d":
$ cd /etc/php5/apache2/conf.d
$ sudo ln -s ../../mods-available/xdebug.ini 20-xdebug.ini
$ ls -l
lrwxrwxrwx 1 root root 31 Sep 11 19:42 20-xdebug.ini -> ../../mods-available/xdebug.ini
4.- Check PHP configuration file "/etc/php5/apache2/php.ini" for the following settings:
; Turn on the error display for development system,
; but not for production system.
display_errors = On
; Format error in HTML
html_errors = On
5.- Restart the Apache2:
$ sudo service apache2 restart
And it works like a charm
For now Xdebug (Please only use uptil Xdebug 2.6, because later versions had some issues with debugging); only work up to php 7.2 (i.e. less than 7.3). So if you had any other version installed like php 7.3 or 7.4 then you had to also install php 7.2 along side your current php version (mostly because now by default latest version is installed through apt). and then update in between alternatives.
To set PHP 7.0 as the default, run
update-alternatives --set php /usr/bin/php7.0
To set PHP 7.2 as the default, run
update-alternatives --set php /usr/bin/php7.2
To set PHP 7.3 as the default, run
update-alternatives --set php /usr/bin/php7.3
To set PHP 7.4 as the default, run
update-alternatives --set php /usr/bin/php7.4
Before we can configure Apache to use PHP 7.2, we need to disable the new (or old) version of PHP by typing
a2dismod php7.4
Now enable the newly installed PHP 7.2 version with the following command:
a2enmod php7.2
Restart the Apache web server for the changes to take effect:
sudo systemctl restart apache2

How to get Xdebug to work on a Mac

I have spent a lot of time on this with no end product.
Installed MAMP.
Found "make" (was installed in different folder)
Installed autoconf which was missing so I can run phpize
Downloaded, compiled and installed xdebug according to:
http://www.xdebug.org/find-binary.php
Made necessary changes to correct php.ini.
Restarted MAMP - but phpinfo() does not show xdebug.
No matter what I do to the php.ini file located at /Applications/MAMP/conf/php5.3/php.ini, nothing changes. The site still loads fine. Even if I nuke it completely. Yet that is what phpinfo() shows it is loading.
What am I overlooking?
php.ini
[xdebug]
zend_extension=/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
The site where you can download precompiled binaries of xdebug had been down all morning (activestate) which is why I was trying to compile my own.
I just found out the site was back online, downloaded the xdebug.so file, and it is now loading.
Modern MACs have two kinds of binaries - 32-bit and 64-bit. Verify that you PHP matches your xdebug: do file Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so then file /path/to/mamp/Library/modules/php5.3/libphp5.so and see if they both show i386 or x86_64.
I just did it and it worked. Here is what I did:
install PECL in order to install Xdebug
download http://pear.php.net/go-pear.phar
in the download directory execute php -d detect_unicode=0 go-pear.phar
now add the ~/pear/bin folder to your path echo "export PATH=$PATH:/Users/the-user/pear/bin" >> .bash_profile
and make the change visible to your terminal . .bash_profile
install Xdebug
now that you have PECL it's as easy as sudo pecl install xdebug
now you need to add a line to php.ini
the php.ini on my mac (Lion) is /etc/php.ini.default
search for zend_extension and uncomment the line if it is correct or change it if it is not (in my case it was correct)
That's it. Unless you want to debug form IntelliJ Idea. In which case I had to copy /etc/php.ini.default to /etc/php.ini
have fun with PHP
Just to point out the obvious, but one that I keep throwing away time on; in an apache2 environment remember to restart apache2 for the changes to take effect.
sudo apachectl restart

Categories