I want to install the php-mode on my windows 7 machine. I went through documentation of the cited website and there is no mention of what should be extra required to run this mode. Obviously, the PHP interpreter and some server, I would like to use MySQL as well. So what is the best setup to have them all (please cite the download websites where necessary). I know there are all-in-one installers for Windows like XAMPP, but what other workflows and alternatives are there other than that? What is recommended with regards to an effective Emacs ecosystem? I am just unaware of the possibilities.
What is special about installation of this mode in Windows apart from:
require ('php-mode)
in the dot emacs file?
I want also to indent an HTML content inside a PHP construct. I mean indentation of something similar to the MWE below:
MWE -- page.php inside templates folder
<?php
return "<!DOCTYPE html>
<html>
<head>
<title>$pageData->title</title>
<meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
</head>
<body>
$pageData->content
</body>
</html>";
?>
It might be helpful to share part of the dot emacs file code related only to php-mode. Thanks.
Notes
- I added the
c:\xampp\php\php.exeto PATH variables but when I pressC-c C-rof php code it throws this error:php-send-region: Searching for program: no such file or directory, php
Update
There was a bug and thankfully fixed by the developer: https://github.com/ejmr/php-mode/issues/228#issuecomment-77057035. Now, after applying the fix in the source and setting the PATH variable correctly in Windows to c:\xampp\php instead of c:\xampp\php\php.exe, C-c C-r is generating the *PHP* buffer.
Question
How to show the output of PHP code from the *PHP* buffer? What is the workflow to show the output in whatever browser available?
php-executableat line 110 of the current Github source code: github.com/ejmr/php-mode/blob/master/php-mode.el The default is/usr/bin/php. So, you may want to try:(setq php-executable "c:\xampp\php.exe")-- that being said, it's been about 15 years since I played with php / mysql / etc on Windows and I really don't remember how I eventually set that up, sorry. In terms of indenting, I like to manually indent and have visual vertical lines help me with how things should line up, however, most people seem to prefer auto-indentation.c:\xampp\php.exedidn't solve it. Still throwing exactly the same error.(call-process "php" nil php-buffer nil "-r" cleaned-php-code)))). Now that you have set thephp-executablecorrectly, you can substitute"php"with the variable without quotation marks:(call-process php-executable nil php-buffer nil "-r" cleaned-php-code))))That should do the trick, but you'd need to modify the source, and if needed, re-byte-compile. Alternatively, you can keep fiddling around with the path in an effort to helpcall-processfind yourphpexecutable.C-c C-rworks by generating a the*PHP*buffer but how to show the output in the browser from there? Any help would be much appreciated if you still remember your workflow under Windows. Thanks.start-processon Windows XP -- I haven't ever usedphp-mode. The following example contemplates the existence of a php file in the webserver directory namedtest.php:(start-process "process-name" nil "c:/Program Files/Internet Explorer/IEXPLORE.EXE" "http://localhost/test.php")The following example contemplates the existence of an html file anywhere on the computer that is readable:(start-process "process-name" nil "c:/Program Files/Internet Explorer/IEXPLORE.EXE" "y:/.0.lawlist.git/public_html/index.html")