Need help to debug a line of code!

Need help to debug a line of code!

by Jean-Nicolas Dufresne -
Number of replies: 1

Hi,

I'm quite a novice in PHP and I'm having difficulty to understand why the following line of code doesn't work:

$command = "cd $basedir/$tempdir; CFG->unzip -o ".basename($form->reference)." imsmanifest.xml 2>&1";

exec($command);

It doesn't give me an error message but it also do nothing! Note that this is a piece of code I was given, I haven't wrote it...mixed
What it's intended to do is extract a file from a zipped file.

Does anyone can help please?
Thanks!

Average of ratings: -
In reply to Jean-Nicolas Dufresne

Re: Need help to debug a line of code!

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi,

perhaps a "$" before the CFG->unzip is needed ?

Anyway, if you insert a line (before the "exec" one) with:

echo $command;

you will be able to see what exact command are going to execute.

Ciao smile