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

前端 未结 8 729
南方客
南方客 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:27

    I use #! /usr/bin/env perl as the shebang on all of my perl, whether on *nix or Windows. Windows just ignores it, and the Unixen follow env to the chosen perl disto.

    0 讨论(0)
  • 2020-11-29 09:29

    I use #!/usr/bin/perl in my scripts and configure Apache on Windows to ignore the shebang line. Add

     ScriptInterpreterSource Registry-Strict
    

    to your httpd.conf and set up the Windows Registry key as explained in the Apache docs.

    Here is what I get when I export the key:

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI\Command]
    @="c:\\opt\\perl\\bin\\perl.exe"
    

    I have been using this setup with Apache and ActiveState Perl on my Windows laptop and the Apache and Perl distributions that come with ArchLinux on my server.

    The Apache docs (to which I linked above) state:

    The option Registry-Strict which is new in Apache 2.0 does the same thing as Registry but uses only the subkey Shell\ExecCGI\Command. The ExecCGI key is not a common one. It must be configured manually in the windows registry and hence prevents accidental program calls on your system. (emphasis mine)

    0 讨论(0)
提交回复
热议问题