PHP quizz with pdo

Re: PHP quizz with pdo

por Didier BERNARD -
Número de respuestas: 3

ok, i reply to myself. :)

so to make it works, i changed the file application/libraries/php_task.php on the jobe server, and replace the line:

$this->default_params['interpreterargs'] = array('--no-php-ini');

by

$this->default_params['interpreterargs'] = array('--no-php-ini -d extension=pdo.so -d extension=pdo_sqlite.so -d extension=json.so');


En respuesta a Didier BERNARD

Re: PHP quizz with pdo

por Richard Lobb -

Good that you've found a solution, but I'd recommend against editing the Jobe source code as it creates on-going maintenance problems every time a new version is released.

What you've set is the default interpreter args, but you can set explicit interpreter args within the CodeRunner question itself and these will override the default. Customise your question, open the Advanced Customisation panel and in the Sandbox > Parameters field enter what you want, using JSON, e.g.

{"interpreterargs": ["-d blah"]}

Or better, create a new question type and make that change there - then all your questions that need those extensions can be of that new type.

Mind you, I'm not quite sure why you needed to make those changes anyway. The required extensions are clearly all there, just not being used by default. Perhaps as a consequence of the --no-php-ini interpreter arg? Unfortunately I can't remember why I chose to disable php-ini in PHP questions - perhaps it opens a security hole? In any case it might be interesting to try setting the interpreterargs to the empty list to see if that also enables all the missing extensions?

En respuesta a Richard Lobb

Re: PHP quizz with pdo

por Didier BERNARD -

Ok, i did it (with the sandbox parameters), and it works and it's less "ugly".

:)

Thanx, great job.

En respuesta a Didier BERNARD

Re: PHP quizz with pdo

por Ping Zhang -
Hi Didier,

I only find you have use PHP + PDO. Have you tried "INSERT"? I got HY000 error and believe it is the permission issue of db file. If you know how to adjust the permission, many thanks!

Thanks,

Ping