Question
Is it possible to have a php script in a twiki page, such that the script will generate for example a twiki table from data queried from a database?
Environment
--
DanBarDov - 12 Dec 2006
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
I've set "php_admin_flag engine on" in twiki_httpd.conf, and I enabled includeurl in configure. I do not get any errors in apache's error log when loading the page, but I also don't get anything from the included php script.
I used
% INCLUDE{https://twiki.org/p/pub/Support/PhpScript/test.php.txt raw="on"}% in order to run my test script. If I could do this inline, I'd prefer it.
--
DanBarDov - 12 Dec 2006
Even if it would be possible to configure the system to execute PHP code in TWiki topic text I would
not recommend it. This is a
big security hole because arbitrary code can be executed on the server by anyone editing a TWiki topic.
You can however safely INCLUDE a PHP generated webpage into a TWiki topic.
--
PeterThoeny - 13 Dec 2006
Can you explain how.
I'd like the page to be re-generated each time the topic is loaded.
Security is not an issue - this is for an intranet.
--
DanBarDov - 13 Dec 2006
Simply
%INCLUDE{http://otherserver.example.com/some/php/script.php}%. This will load the page each time you look at the TWiki topic. If inclined, put that into an IFRAME, see
IFrameExample.
--
PeterThoeny - 14 Dec 2006