Asked  7 Months ago    Answers:  5   Viewed   1.7k times

I am trying to install and setup Laravel 4 through the Git Shell using this tutorial:

It all seems to be working until I have to run php artisan key:generate at which point it gives me the error:

php : The term 'php' is not recognized as the name of a cmdlet, function, script file, or operable program

I have hunted around and am not sure how to go about setting this up so it recognizes PHP.

Does anyone have any ideas or know of a thorough tutorial to get Laravel 4 setup?



Try adding your PHP.exe's folder to your System PATH variables, so PHP can be accessed via terminal.

For example; C:wampbinphpphp5.4.3

To add new PATH variable, follow this:

  1. Right click on My Computer, select Properties
  2. Select Advanced System Settings
  3. In the System Properties window click the Environment Variables button.
  4. Select System Variables -> PATH and click Edit.
  5. Enter the folder where your PHP.exe is located.

If you did this correctly, restart your terminal and type php --version to check if it works.

Note: Don't forget to seperate paths by using ; seperator.

Wednesday, March 31, 2021
answered 7 Months ago

Generally speaking, the vendor directory is not committed to VCS, as such, doing a clone on a standard Laravel app won't include all its dependencies.

Once you have cloned, doing composer install (or composer update if you want the latest packages as a developer) will fetch the dependencies and allow your app to work.

Wednesday, March 31, 2021
answered 7 Months ago

The first path in the path variable needs to be the NPM path. Opening the Node.js command prompt I found that the ng command worked there. I dug into the shortcut and found that it references a command to ensure the first Path variable is NPM. To Fix:

  1. Right Clicked on My Computer (windows)
  2. Selected Advanced System Settings
  3. Clicked "Environment Variables"
  4. Under "Path" variable, made the FIRST value listed %AppData%npm

Once I did that I was able to close powershell and reopen and all worked.

Wednesday, June 16, 2021
answered 4 Months ago

I've solved the problem. I've corrected the description of the problem to make it accurate.

The source of the problem is that I was incorrectly using the Param keyword multiple times. The correct usage is to declare multiple parameters within a single Param declaration like the following:

Param($p, $d)

This usage is explained in the Windows PowerShell Help article "about_Functions".

Monday, August 9, 2021
answered 2 Months ago

An alternative method to this would be to check for the 'If-Modified-Since' request header as it will only be present if the browser already has the file.

If it is present, then you know the file is already created and can respond with a link to it, otherwise run your code above. Something like this...

// check if the client validating cache and if it is current
if ( isset( $headers['If-Modified-Since'] ) && ( strtotime( $headers['If-Modified-Since'] ) == filemtime( $image->get_full_path() ) ) ) {

    // cache IS current, respond 304
    header( 'Last-Modified: ' . $image->get_last_modified(), true, 304 );

} else {

    // not cached or client cache is older than server, respond 200 and output

    header( 'Last-Modified: ' . $image->get_last_modified(), true, 200 );
    header( 'Content-Length: ' . $image->get_filesize() );
    header( 'Cache-Control: max-age=' . $image->get_expires() );
    header( 'Expires: '. gmdate('D, d M Y H:i:s GMT', time() + $image->get_expires() ) );
    header( 'Content-Type: image/jpeg');

    print file_get_contents( $image->get_full_path() ); 
Thursday, September 30, 2021
answered 2 Weeks ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :