GNU Emacs 24.5.1, installed MELPA, installed php-mode. The directory ~/.emacs.d/elpa/php-mode-20180105.541/ exists.

I added the following lines to .emacs:

(add-to-list 'load-path "~/.emacs.d/elpa")
(require 'php-mode)

I presume it's that last line that's triggering the error. I ran C-h v load-path and it includes ~/.emacs.d/elpa/php-mode-20180105.541/

emacs --debug-init didn't help me.

Any suggestions?

1 Answer 1


I think you're mixing up require with using a package. When you say (require 'php-mode) Emacs looks for a file (or a feature) named php-mode in your load-path. ~/.emacs.d/elpa is in your load-path, but there is no file php-mode.el in that directory.

You'll need to use the package system, not require, if you expect Emacs to dig into a package directory.

Or if there is a file php-mode.el[c] in directory ~/.emacs.d/elpa/php-mode-20180105.541/ then add that directory to your load-path before using require. (And I think you forgot the ~/, at least in your question, if not in fact.)

  • Okay, I understand. I didn't realize that the package system did more than install packages. That clears things up considerably. Thx.
    – Chap
    Jan 17, 2018 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.