How do I ignore the Perl shebang on Windows with Apache 2?

前端 未结 8 762
南方客
南方客 2020-11-29 08:31

I have set up a local Perl web environment on my Windows machine. The application I\'m working on is originally from a Linux server, and so the shebang for source .pl<

8条回答
  •  死守一世寂寞
    2020-11-29 09:17

    1. Install any Windows Bash flavor (such as Cygwin, MSYS2 or GnuWin32);
    2. Create a trivial redirecting shell script:

      exec "@"
      
    3. Create a registry entry:

      Windows Registry Editor Version 5.00
      
      [HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command]
      @=" "
      
      [HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI\Command]
      @=" "
      
      [HKEY_CLASSES_ROOT\.py\Shell\ExecCGI\Command]
      @=" "
      

      (...and so on.)

    4. Jot in your httpd.conf file:

      ScriptInterpreterSource Registry
      

    Apache will now resolve Unix shebangs relative to the interpretation given by your choosen Bash flavor. This gives much more flexibility than hardcoding interpreter paths in the registry.

提交回复
热议问题