How to use PHP inside Confluence pages
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
目的
For security reasons, Confluence does not allow PHP code inside pages. However, it's possible to install an Apache and PHP module on the same server, and include the PHP file so that the output can be shown inside Confluence.
ソリューション
- Install Apache + PHP in a server (it can be the same server used for Confluence).
- In Confluence navigate to Confluence Admin > Manage Add-ons and enable the
html
andhtml-include
macros. - Create a PHP file for test purposes on your Apache. Make sure that it's working locally.
- Copy the URL from the PHP file and paste it in Confluence Admin > Whitelist so that Confluence will trust it.
- Create a page on Confluence and use the
html-include
macro with the URL from Step 4. - This will allow the PHP file to be interpreted by Apache, and the result will be shown in Confluence.
最終更新日: 2025 年 1 月 27 日
Powered by Confluence and Scroll Viewport.