svn: /phpdoc/en/trunk/install/windows/ commandline.xml index.xml manual.xml

From: Date: Tue, 28 Jul 2009 11:22:26 +0000
Subject: svn: /phpdoc/en/trunk/install/windows/ commandline.xml index.xml manual.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-4539@lists.php.net to get a copy of this message
rquadling Tue, 28 Jul 2009 11:22:26 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=286450 Log: Bug#42194 - Document how to get command line script working like BAT files without the need to supply the executable or the extension and have all parameters supplied passed to the script. Bug: http://bugs.php.net/42194 (To be documented) $argc/$argv[] won't work when .php extension is assigned to php.exe Changed paths: A phpdoc/en/trunk/install/windows/commandline.xml U phpdoc/en/trunk/install/windows/index.xml U phpdoc/en/trunk/install/windows/manual.xml Added: phpdoc/en/trunk/install/windows/commandline.xml =================================================================== --- phpdoc/en/trunk/install/windows/commandline.xml (rev 0) +++ phpdoc/en/trunk/install/windows/commandline.xml 2009-07-28 11:22:26 UTC (rev 286450) @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- $Revision: 283796 $ --> + <sect1 xml:id="install.windows.commandline" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <title>Command Line PHP on Microsoft Windows</title> + <para> + This section contains notes and hints specific to getting PHP running + from the command line for Windows. + </para> + <note> + <para> + You should read the <link linkend="install.windows.manual">manual + installation steps</link> first! + </para> + </note> + <para> + Getting PHP to run from the command line can be performed without making + any changes to Windows. + <screen> +<![CDATA[ +C:\PHP5\php.exe "C:\PHP Scripts\script.php" arg1 arg2 arg3 +]]> + </screen> + </para> + + <para> + But there are some easy steps that can be followed to make this simpler. + Some of these steps should already have been taken, but are repeated here + to be able to provide a complete step-by-step sequence. + <itemizedlist> + + <listitem> + <para> + Add the location of the PHP executable (<filename>php.exe</filename>, + <filename>php-win.exe</filename> or <filename>php-cli.exe</filename> + depending upon your PHP version and display preferences) to the + <varname>PATH</varname> environment variable. Read more about how to + add your PHP directory to <varname>PATH</varname> in the <link + linkend="faq.installation.addtopath">corresponding FAQ entry</link>. + </para> + </listitem> + + <listitem> + <para> + Add the <literal>.PHP</literal> extension to the + <varname>PATHEXT</varname> environment variable. This is can be done + at the same time as amending the <varname>PATH</varname> environment + variable. Follow the same steps as described in the <link + linkend="faq.installation.addtopath">FAQ</link> but amend the + <varname>PATHEXT</varname> environment variable rather than the + <varname>PATH</varname> environment variable. + <note> + <para> + The position in which you place the <literal>.PHP</literal> will + determine which script or program is executed when there are matching + filenames. For example, placing <literal>.PHP</literal> before + <literal>.BAT</literal> will cause your script to run if there is a + batch file with the same name. + </para> + </note> + </para> + </listitem> + + <listitem> + <para> + Associate the <literal>.PHP</literal> extension with a file type. This + is done by typing the running the following command: + <screen> +<![CDATA[ +assoc .php=phpfile +]]> + </screen> + </para> + </listitem> + + <listitem> + <para> + Associate the <literal>phpfile</literal> file type with the appropriate + PHP executable. This is done by typing the running the following command: + <screen> +<![CDATA[ +ftype phpfile=php.exe "%1" %* +]]> + </screen> + </para> + </listitem> + + </itemizedlist> + </para> + + <para> + Following these steps will allow PHP scripts to be run from any directory + without the need to type the PHP executable or the <literal>.PHP</literal> + extension and all parameters will be supplied to the script for processing. + </para> + + <para> + The example below details some of the registry changes that can be made manually. + <example> + <title>Registry changes</title> + <screen> +<![CDATA[ +Windows Registry Editor Version 5.00 + +[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.php] +@="phpfile" +"Content Type"="application/php" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\phpfile] +@="PHP Script" +"EditFlags"=dword:00000000 +"BrowserFlags"=dword:00000008 +"AlwaysShowExt"="" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\phpfile\DefaultIcon] +@="C:\\PHP5\\php-win.exe,0" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\phpfile\shell] +@="Run" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\phpfile\shell\Run] +@="&Run" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\phpfile\shell\Run\command] +@="\"C:\\PHP5\\PHP.EXE\" \"%1\" %*" +]]> + </screen> + </example> + </para> + + </sect1> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> Modified: phpdoc/en/trunk/install/windows/index.xml =================================================================== --- phpdoc/en/trunk/install/windows/index.xml 2009-07-28 10:05:54 UTC (rev 286449) +++ phpdoc/en/trunk/install/windows/index.xml 2009-07-28 11:22:26 UTC (rev 286450) @@ -56,6 +56,7 @@ &install.windows.xitami; &install.windows.building; &install.windows.extensions; + &install.windows.commandline; </chapter> <!-- Keep this comment at the end of the file Modified: phpdoc/en/trunk/install/windows/manual.xml =================================================================== --- phpdoc/en/trunk/install/windows/manual.xml 2009-07-28 10:05:54 UTC (rev 286449) +++ phpdoc/en/trunk/install/windows/manual.xml 2009-07-28 11:22:26 UTC (rev 286450) @@ -380,6 +380,12 @@ server, and enable it to run PHP. Choose a web server from the table of contents. </para> + <para> + In addition to running PHP via a web server, PHP can run from the command + line just like a <literal>.BAT</literal> script. See + <link linkend="install.windows.commandline">Command Line PHP on Microsoft + Windows</link> for further details. + </para> </sect1> <!-- Keep this comment at the end of the file

« previous php.doc.cvs (#4539) next »