How I can turn on highilighting php code in org-mode structure block?
-
I can't find ob-php anywhere. I think it is not supported in babel org-mode. – manandearth Nov 06 '18 at 22:08
-
1[https://github.com/stardiviner/ob-php](https://github.com/stardiviner/ob-php) I just copy paste ob-php.el into my init.el so I can execute php code. The author of ob-php wrote 'I put it in Org-mode contrib/ now.' but I couldn't find it int org-mode files. Any ideas how highlighting can be done? Maybe from other packages? – slk500 Nov 06 '18 at 22:20
-
Maybe it's been added to a new version of `org-mode` that isn't bundled with any version of Emacs yet. – Nov 08 '18 at 20:15
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.

- 123
- 6
-
It should be noted that with the latest version of Org mode, ob-php breaks due to a recursive require of `org` on line 17 of `ob-php.el`. This line should be commented out and the compiled `ob-php.elc` file removed in order to get things working again. – Chris Charabaruk Jan 16 '19 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 Aug 16 '21 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.

- 461
- 2
- 14