Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can achieve what you can see below? I read this question but did not succeed. My OS is Lubuntu 13.10 which is based in Ubuntu 13.10

You are technically ready to go, but
there's one extra step that I like to do to make command line debugging nice
and quick. I create a bash script called "php-xdebug", which automatically
starts the debugger engine. The script looks like this (unix only): >

#!/bin/bash
export XDEBUG_CONFIG="idekey=xdebug"
/usr/bin/php "$@"
<
Run "chmod +x" on the file and put it somewhere in your $PATH list, and you can
then use this instead of php when debugging. For instance, instead of "php
myscript.php", run "php-xdebug myscript.php" to start the debugger session.
share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

The PATH is a list of folders which are automatically checked for executables when you run a program name. Here is what we do.

After the comment below there seems to be more of a problem so lets start from scratch.

Open gedit

Paste in

#!/bin/bash
export XDEBUG_CONFIG="idekey=xdebug"
/usr/bin/php "$@"

Save as

php-xdebug.sh

Go to the folder (in the terminal) with the file and run

chmod +x php-xdebug.sh

Then check what your PATH is with:

echo $PATH

You could move the file into one of the folders listed when you ran this command.

Normally a better solution is to edit the PATH (tutorial here) to search inside the folder where the script already is.

Now try:

php-xdebug.sh
share|improve this answer
    
Thanks for your answer, Julian. I am not able to understand the last line of your answer. May you explain it in other words, please? Thanks in advance. –  pablofiumara Dec 20 '13 at 15:16
    
Edited, does that make more sense. If not tell me exactly what is confusing you and I will try again! –  Julian Stirling Dec 20 '13 at 15:21
    
Thanks for editing your answer. Now it is clearer. After reading the last paragraph of the most voted answer [askubuntu.com/questions/60218/… (this question),I decided to apply the answer below it (which has around 50 voted). If I type in the terminal echo $PATH, I can see many paths separated by : One of them is the one I have just added. Inside that path, there is a file I am targetting. Problem is that I sourced my .bashrc but it seems that the terminal does not recognise php-xdebug command. The error says php-xdebug: command not found –  pablofiumara Dec 20 '13 at 15:33
    
Should I add .sh to the end of filename? The file has this inside it: #!/bin/bash export XDEBUG_CONFIG="idekey=xdebug" /usr/bin/php "$@" –  pablofiumara Dec 20 '13 at 15:36
    
You beat me too it by 1 min!! See edit above. –  Julian Stirling Dec 20 '13 at 15:39
show 4 more comments

On Ubuntu (including Lubuntu), one natural place to put such a script is in ~/bin. If that folder does not exist already, do

mkdir ~/bin

Next time you log in, it will be automatically included in PATH, i.e. no need to alter the PATH variable.

share|improve this answer
    
Thank you for your answer! –  pablofiumara Dec 20 '13 at 17:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.