Installing Xdebug on a remote server (bluehost.com)

2.3k views Asked by At

I have xdebug installed and working on my mac but I can't seem to get it installed on my server ( a bluehost.com server). I have been trying for ages and would appreciate any help possible.

Basically I have downloaded 'xdebug.so' and installed it in my /public_html/ directory

I then go into my php.ini file (which is in the same directory) and I remove any other [zend] references and inserted the following:

zend_extension=/home1/[myUserName]/public_html/xdebug.so
zend_extension_ts = /home1/[myUserName]/public_html/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_mode=req

This is basically exactly as what I have on my mac and it's working fine.

The reasons I have 'home1' instead of 'home' is because that's how bluehost set up my site. Also I have tried using both just to check but without luck.

When I run phpInfo() I don't get any references to Xdebug.

I'm at a loss here it took me hours to set it up on my mac (months ago) and now I have spent hours trying to set it up on my server.

Note: I have connyacted bluehost.com for help but am still waiting. They also say they don't provide support for such issues so I am not holding my breath.

Thanks in advance!

2

There are 2 answers

1
Linus Kleen On

xdebug.remote_host points to where X-Debug is supposed to connect to when hitting a breakpoint. Unless you're running a debugger on your server, localhost needs to be set to your current IP address.

Also, if you're in full control of that server, install X-Debug "properly". I.e. on a server running Debian, you'd have to apt-get install php5-xdebug.

0
Lost On

There is some reasons that might cause this issue:

  1. compiled extensions is not compatible with current environment(might cause by compiler, php version, and unexpected config)

  2. invalid php.ini configuration (invalid extension_dir, even wrong ini file refer)

  3. and more...


Workable Solution

please refer to official tutorial here

  1. Create some necessary directories

mkdir ~/pecl ~/php ~/php/extensions

  1. Download and extract xdebug into pecl folder
    • for me, I need xdebug v2.5.5 since latest xdebug not support php 5.6

pecl download xdebug-2.5.5 && tar -xvzf xdebug-2.5.5

  1. Enter xdebug folder and compile the extension

cd xdebug-2.5.5

phpize

./config --prefix=$HOME/pecl/xdebug-2.5.5

make

  1. Enter modules folder and copy the module to proper location

cp xdebug.so ~/php/extensions

  1. set extension in php.ini
    • for me, php.ini was created under public_html

zend_extension=/home{#}/{username}/php/extensions/xdebug.so

  1. Create a file called "phpinfo.php" and check whether the xdebug is setup successfully or not.