Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It seems like you're having trouble with the <code>PATH</code> in the Windows command shell. This is independent of Zend Framework. Understanding the <code>PATH</code> concept in a shell environment is a hurdle many programmers have to overcome, but once you get it, you can use it to increase your productivity.</p> <p>You can always run a program from the command shell using that program's <strong>absolute path</strong>. For example:</p> <pre><code>C:\&gt; c:\wamp\bin\php\php.exe </code></pre> <p>You can also run a command using a <strong>relative path</strong>. That is, you enter the path from your current working directory to the location of the program you want to run.</p> <pre><code>C:\&gt; cd c:\wamp C:\&gt; bin\php\php.exe </code></pre> <p>But if you run a command in the command shell <em>without</em> naming the full path to the executable, the shell tries to find the program executable in one of the directories listed in your <code>PATH</code> environment variable. That is, the path is a string with directory names separated by semicolons. To run an executable, the shell tries each directory in that list, in order, as if you had</p> <pre><code>C:\&gt; type %PATH% C:\WINDOWS\;C:\WINDOWS\SYSTEM32 C:\&gt; php.exe ...error that it cannot find php.exe... </code></pre> <p>Special case: running <code>php.exe</code> also works if your current working directory happens to be the location of that program executable. But that's just an example of using a relative path, using a path with zero directory levels.</p> <p>Second problem is that you're running <code>zf.bat</code> which is a script that in turn invokes <code>php.exe</code> without specifying a path. It assumes you have added the location of <code>php.exe</code> to your <code>PATH</code> environment variable. </p> <pre><code>C:\&gt; SET PATH=%PATH%;C:\wamp\bin\php C:\&gt; php.exe -v PHP 5.3.1 (cli) (built: Nov 29 2009 13:59:20) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies </code></pre> <p>The <code>zf.bat</code> script itself also needs to be found. You can do this by adding the directory where it resides to your <code>PATH</code>. Assuming you installed Zend Framework under <code>C:\zf</code>, for example:</p> <pre><code>C:\&gt; type %PATH% C:\WINDOWS\;C:\WINDOWS\SYSTEM32;C:\wamp\bin\php C:\&gt; zf.bat ...error that it cannot find zf.bat... C:\&gt; SET PATH=%PATH%;C:\zf\bin C:\&gt; zf.bat show version Zend Framework Version: 1.10.0dev </code></pre> <p>I would also recommend that you install Zend Framework <strong><em>outside</em></strong> your <code>htdocs</code> directory. There's only one PHP file you need under your <code>htdocs</code>: that is the single bootstrap file that Zend Framework uses to instantiate the Front Controller and dispatch the request.</p> <p>When you use <code>zf.bat</code> to generate an skeleton application for you, it creates a directory <code>public</code> with a PHP script <code>index.php</code> inside that directory. This <code>index.php</code> file is the one you need to be in your <code>htdocs</code> directory. You also need assets like CSS, Javascript, and images to be under your <code>htdocs</code>. The rest of your application code, and the entire Zend Framework itself, should be <em>outside</em> your <code>htdocs</code>. Especially any config files where you store sensitive data such as your database password, etc.</p> <p>You can edit the <code>index.php</code> file. It may define a PHP constant <code>APPLICATION_PATH</code>, which is the location of the rest of your application code. </p> <pre><code>&lt;?php defined("APPLICATION_PATH") || define("APPLICATION_PATH", realpath(dirname(__FILE__) . "/../application" )); </code></pre> <p>That default definition for <code>APPLICATION_PATH</code> assumes that your <code>htdocs</code> is a sister directory to the rest of your application code generated by the <code>zf.bat</code> tool. You can certainly put your app code anywhere else, but you have to change the above code so that the <code>index.php</code> script finds it.</p> <p>Also the <code>index.php</code> script may add the location of library code to PHP's <code>INCLUDE_PATH</code>. This is useful if you need to make the Zend Framework library findable, or if you use other third-party PHP code in your application. Assuming you installed Zend Framework under <code>C:\zf</code>, you should add its <code>library</code> subdirectory to your PHP <code>INCLUDE_PATH</code>.</p> <pre><code>// Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array( "C:/zf/library", realpath(APPLICATION_PATH . "/../library"), get_include_path() ))); </code></pre> <p>The code templates generated by the <code>zf.bat</code> script try to make sensible default guesses about where your code is located, but your environment is your own, and it's easy to edit these scripts to specify the true location where you installed your code and libraries.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload