Find the answer to your Linux question:
Results 1 to 6 of 6
Hello there, I am just starting out with ubuntu. I downloaded emacs, and wanted to use php-mode, so i downloaded something called php-mode. I would have posted a link, but ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    39

    How do I install php mode on emacs?


    Hello there,

    I am just starting out with ubuntu.

    I downloaded emacs, and wanted to use php-mode, so i downloaded something called php-mode. I would have posted a link, but this forum restricts me from doing that.

    Inside are a bunch of files, and no readme. I tried to ask google how to install this, but found nothing that made sense to me (i am still a n00b).

    So I wanted to ask if somebody could give me comprehensive directions.

    Thanks!

    Kind regards,
    Marius

  2. #2
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    You should in almost all cases default to installing software through your package manager.

    Code:
    sudo apt-get install php-elisp
    Ubuntu -- Details of package php-elisp in maverick

  3. #3
    Just Joined!
    Join Date
    Dec 2010
    Posts
    39
    Will this apt-thing (how do i know which packages can be installed with this method?) find the custom directory i chose for my emacs?

    Thanks.M

  4. #4
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    How did you install emacs? If it wasn't using the package manager, then installing php-elisp that way will also install emacs again, since it won't recognize a manual install.

    Package management:
    Debian Linux apt-get package management cheat sheet

    https://help.ubuntu.com/community/SynapticHowto

    https://help.ubuntu.com/community/Repositories/Ubuntu

  5. #5
    Just Joined!
    Join Date
    Dec 2010
    Posts
    39
    Quote Originally Posted by reed9 View Post
    How did you install emacs? If it wasn't using the package manager, then installing php-elisp that way will also install emacs again, since it won't recognize a manual install.


    Thanks! How I intalled emacs? I followed the directions on the GNU Emacs website about how to obtain emacs. Believe I downloaded a tar.gz.

    How would i install php on emacs manually? php-mode came with no readme.

    Thanks for helping.

    Kind regards,
    Marius

  6. #6
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    Well, I don't really use emacs, but looking at the package, seems like it's just a make file, so run
    Code:
    make
    sudo make install
    Not sure if make install works in this case. And from the make script it appears to mostly be building the documentation. The heart of it is the php-mode.el file which is already there.

    And, looking around, it seems this is the case, and you can just move that file to the location of your choice.

    How To Install php-mode Without Root Privelages | Karol Krizka
    Using Emacs to edit PHP files Flame’s blog

    So edit your ~/.emacs file and add

    Code:
    (setq load-path (cons "/your/custom/path" load-path))
     
    (autoload 'php-mode "php-mode" "PHP editing mode" t)
    (add-to-list 'auto-mode-alist '("\\.php\\'" . php-mode))
    (add-to-list 'auto-mode-alist '("\\.php5\\'" . php-mode))
    (add-to-list 'auto-mode-alist '("\\.php4\\'" . php-mode))
    (add-to-list 'auto-mode-alist '("\\.php3\\'" . php-mode))
    Replace /your/custom/path with the path to the directory with your php-mode.el file of course.

    Are you opposed to installing emacs the usual (and supported) way?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •