delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/11/09/20:35:34

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=3.5 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT
X-Spam-Check-By: sourceware.org
Date: Thu, 10 Nov 2011 05:27:23 +0400
From: Andrey Repin <anrdaemon AT freemail DOT ru>
Reply-To: Andrey Repin <cygwin AT cygwin DOT com>
Message-ID: <454021696.20111110052723@mtu-net.ru>
To: Timothy Madden <terminatorul AT gmail DOT com>, cygwin AT cygwin DOT com
Subject: Re: Pass windows-style paths to the interpreter from the shebang line ?
In-Reply-To: <j9dvqh$u92$1@dough.gmane.org>
References: <j9dvqh$u92$1 AT dough DOT gmane DOT org>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Greetings, Timothy Madden!

> I would like to write a php script to run from my cygwin command line.
> I have the php CLI executable (php.exe) in PATH and I use
>         #!/bin/env php
> as the first line of the .php script, and make it executable.

Dearly use Windows native version of PHP

And here's a simple command file to register your PHP as script interpreter
for both simple execution and windows scripting host jobs.

@echo off
if "!%~dpnx1" == "!" (echo Usage: %~dp0 path_to_php-cli.exe && exit)
if not exist "%~dpnx1" (echo Invalid path to PHP interpreter && exit)
ftype PHPScript="%~dpnx1" -f "%%1" -- %%*
assoc .php=PHPScript
regsvr32 "%~dp1\php5activescript.dll"

If you still insist on using shebang, just use "#! php" without any additions.
That assuming you have PHP in your application search path. Which is not
limited to $PATH, so to speak.


--
WBR,
Andrey Repin (anrdaemon AT freemail DOT ru) 10.11.2011, <05:19>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019