How I can turn on highilighting php code in org-mode structure block?
2 Answers
ob-php is now in Org mode contrib and available through the org-plus-contrib package in Org ELPA.
You can install this package by adding Org ELPA to your package-archives list in your init file:
(require 'package)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
Then you can install the org-plus-contrib package by opening the package manager (M-x list-packages), locate the package (C-s org-plus-contrib RET), mark it for installation (i), and finally actually install it (x). (It'd be nice if the package module offered an install-package command but until it does, you'll have to go through this process.)
If you don't want all of contrib, then you'll have to grab ob-php directly from the Org mode Git repository (direct link) and load it yourself from your init file.
-
It should be noted that with the latest version of Org mode, ob-php breaks due to a recursive require of
orgon line 17 ofob-php.el. This line should be commented out and the compiledob-php.elcfile removed in order to get things working again.Chris Charabaruk– Chris Charabaruk2019-01-16 15:18:05 +00:00Commented Jan 16, 2019 at 15:18 -
1Going forward it appears that ob-php will be removed from the new org-contrib ELPA package after Org 9.5 is released.Chris Charabaruk– Chris Charabaruk2021-08-16 18:52:50 +00:00Commented Aug 16, 2021 at 18:52
With the current versions of php-mode and org-mode, PHP syntax highlighting in org code blocks happens by default.
The version of org-mode in Emacs 26.1 includes this support. For earlier versions of Emacs you can install a newer version of org-mode from its ELPA repository.
So if you have at least Emacs 26.1 for php highlighting in org-mode you need to just install php-mode.
-
Your answer isn't complete. Can you add the entire solution to your problem?user12563– user125632018-11-08 20:16:48 +00:00Commented Nov 8, 2018 at 20:16

org-modethat isn't bundled with any version of Emacs yet.<?phpfor syntax highlighting to work