@lord Thanks for starting this gem. It's been pretty useful to my company on a project containing some PHP. However, we ran into a couple of issues that prevented us from accessing the full functionality of existing PHP scripts. This pull request resolves those issues, making middleman-php more useful for everyone. Specifically, the pull request enables middleman-php to:
Inject a $_REQUEST variable, created by merging $_ENV, $_GET, $_POST, $COOKIE, and $SERVER. Of course, middleman-php only supplies $_GET and $_POST, and only when certain conditions are met. Fortunately, PHP initializes all of these variables, so we can safely merge whatever it has into $_REQUEST. (Later we can think about adding $_COOKIE and $_SERVER.)
Change the working directory of the PHP execution context to match the directory containing the script, as this is the norm when running PHP scripts from typical web servers such as Apache. This allows PHP scripts to access files using paths relative to the script location, just as they would when running from Apache.
Set the debug mode based on a user setting in the Middleman project's config.rb file, defaulting to false so that middleman-php isn't so chatty on the terminal.
Please let me know if you have any questions or concerns, or go ahead and merge this and publish 0.0.4. :)
@lord Thanks for starting this gem. It's been pretty useful to my company on a project containing some PHP. However, we ran into a couple of issues that prevented us from accessing the full functionality of existing PHP scripts. This pull request resolves those issues, making middleman-php more useful for everyone. Specifically, the pull request enables middleman-php to:
Please let me know if you have any questions or concerns, or go ahead and merge this and publish 0.0.4. :)