- Command php not found in Windows
- PHP command not found in windows
- Laravel PHP Command Not Found
Command php not found in Windows
´php´ is not recognized as an internal or external command,
operable program or batch file
set PATH=%PATH%;C:\xampp\php
PHP command not found in windows
C:\Users\admin>php -v
'php' is not recognized as an internal or external command,
operable program or batch file.
Laravel PHP Command Not Found
nano ~/.bash_profile
export PATH=~/.composer/vendor/bin:$PATH
export PATH="~/.composer/vendor/bin:$PATH"
export PATH="~/.config/composer/vendor/bin:$PATH"
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# download installer
composer global require "laravel/installer=~1.1"
#setting up path
export PATH="~/.composer/vendor/bin:$PATH"
# check laravel command
laravel
# download installer
composer global require "laravel/installer=~1.1"
nano ~/.bashrc
#add
alias laravel='~/.composer/vendor/bin/laravel'
source ~/.bashrc
laravel
# going to html dir to create project there
cd /var/www/html/
# install project in blog dir.
laravel new blog
composer global require "laravel/installer"
vi ~/.bashrc
export PATH="~/.config/composer/vendor/bin:$PATH"
source ~/.bashrc
export PATH="$HOME/.config/composer/vendor/bin:$PATH"
source ~/.zshrc
source ~/.bashrc
export PATH=~/.config/composer/vendor/bin:$PATH
source ~/.bashrc
export PATH="$HOME/.composer/vendor/bin:$PATH"
export PATH="~/.composer/vendor/bin:$PATH"
export PATH="$HOME/.config/composer/vendor/bin:$PATH"
source ~/.zshrc
nano ~/.bash_profile
export PATH=$HOME/.config/composer/vendor/bin:$PATH
ctrl+x and save
source ~/.bash_profile
cd ~
echo $PATH
nano ~/.bash_profile
export PATH="~/.composer/vendor/bin:$PATH"
laravel new yourprojectname
~/.composer/vendor/laravel/installer/laravel
chmod +x ~/.composer/vendor/laravel/installer/laravel
sudo ln -s /Users/zhao/.composer/vendor/laravel/installer/laravel /usr/bin/laravel
set PATH=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
eg: “C:\Users\\AppData\Roaming\Composer\vendor\bin”
eG: laravel new blog
nano ~/.bash_profile
export PATH="/Users/yourusername/.composer/vendor/bin:$PATH"
composer global require "laravel/installer=~1.1"
mv composer.phar /usr/local/bin/composer
php composer.phar require laravel/installer
vendor/laravel/installer/bin/laravel new [ProjectName]
cd ProjectName
git init
git remote add origin [email protected][youGitPathToProject]
composer create-project --prefer-dist laravel/laravel youprojectname
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Sign up
Did you have trouble following our instructions for getting Drupal Console running on Windows? Did something unexpectedly go wrong? Look for a section on this page corresponding to the command-line output you saw, and it might help!
If this still doesn’t help, let us know! Email, or leave a comment on the blog post. Please point us to a Gist containing the complete log of what happened at the command-line, so we can diagnose the problem, and update our instructions.
This package requires PHP >=5.5.9
Problem 1
- This package requires php >=5.5.9 but your PHP version (5.4.45) does not satisfy that requirement.
This means you’re using the wrong version of PHP. Some ways this could happen:
- You forgot to set the PHP version for your site in DevDesktop. Change the PHP version, and open a new command-line.
-
You ran another command that modified your command-line environment. Even running «drush» can cause this to happen! Open a new command-line and you should be fine.
Because of this, we recommend you reserve one command-line window just for Drupal Console. If you need to use other tools, run them in another window.
- You’re using a different command-line entirely, for example one from Git. These instructions all assume you use a command-line properly configured for Drupal, which you can get by clicking the little console button in Dev Desktop.
PHP Parse error
"PHP Parse error: syntax error, unexpected '[' in C:\Users\Dave\Sites\devdesktop\d8\vendor\drupal\console\bin\drupal.php on line 14"
This also means you have the wrong version of PHP. See above.
Could not open input file
"Could not open input file: composer.phar"
This means you haven’t edited the composer.bat file. Fix it.
Your requirements could not be resolved
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for drupal/console >=1.0-rc15 -> satisfiable by drupal/console[1.0.0-rc15].
- drupal/console 1.0.0-rc15 requires drupal/console-core 1.0.0-rc15 -> satisfiable by drupal/console-core[1.0.0-rc15] but these conflict with your requirements or minimum-stability.
Installation failed, deleting ./composer.json.
This can mean that you’re not running Drupal 8, but Drupal 7! Drupal Console only works in Drupal 8.
The system cannot find the path specified
The system cannot find the path specified
Dev Desktop installs by default in C:\Program Files (x86)\DevDesktop
, but this may indicate that you have it installed it at a different path. Adjust all the instructions to use your actual Dev Desktop path.
You can find your Dev Desktop installation path by typing where drush
, and then removing tools\drush.bat
from the end. For example, if the command prints E:\DevDesktop\tools\drush.bat
, your Dev Desktop path is E:\DevDesktop
.
Command site:status is not a valid command
[ERROR] Command "site:status", is not a valid command name.
This could mean the current directory of your command-line shell is not inside a Drupal site directory. If you type dir
, do you see a file update.php? If not, you’ll need to change directory to the right place—or just open up a brand new command-line.
Another possibility is that your Drupal site is not fully installed. Did you run through the install.php process, where you give the site a name and email address? If not, go visit the site in your browser and finish the install process.
The specified database connection is not defined
[ERROR] The specified database connection is not defined: default
This means Drupal Console can’t figure out where your database settings live. Make sure you have installed a very recent version of Drupal Console, at least 1.0-rc15. You can check with composer show
.
‘drupal’ is not recognized
'drupal' is not recognized as an internal or external command,
operable program or batch file.
This means the Drupal Console Launcher is not properly installed. Install it.
php is not recognized
'php' is not recognized as an internal or external command
, or'composer' is not recognized as an internal or external command
, orphp: command not found
, or similar.
This probably means you’re using the wrong command-line—maybe the one that came with Windows, or with Git. These instructions all assume you use a command-line properly configured for Drupal, which you can get by clicking the little console button in Dev Desktop.
Drupal Console is not installed
[ERROR] Drupal Console is not installed at: ...
The current site doesn’t have Console installed. This could be because something went wrong when you ran composer to install Console—look at that error message for more details. It could also be that Console installed fine, once—but this is a second site. You have to install Console in every single site!
Views: 249
The error message bash: php: command not found
indicates that your system is unable to find the PHP binary in your environment’s PATH
, meaning PHP is not installed or isn’t properly configured.
Here are the steps to resolve this issue:
1. Check if PHP is installed
- Run the following command to see if PHP is installed:
#bash
php -v
If PHP is not installed, you’ll get the same command not found
error.
2. Install PHP
If PHP is not installed, you’ll need to install it based on your operating system:
For Ubuntu/Debian:
#bash
sudo apt update
sudo apt install php
For CentOS/RHEL:
#bash
sudo yum install epel-release
sudo yum install php
For macOS (using Homebrew):
#bash
brew install php
3. Ensure PHP is in the system’s PATH
After installation, make sure PHP is in your system’s PATH
. You can add it manually if necessary. For example, add this to your shell configuration file (.bashrc
, .zshrc
, etc.):
#bash
export PATH="/path/to/php:$PATH"
Then reload the configuration:
#bash
source ~/.bashrc # or ~/.zshrc
4. Verify PHP is accessible
After installing or configuring PHP, verify it again:
#bash
php -v
If PHP is installed correctly, this will return the PHP version.
5. Run Artisan Tinker Again
Once PHP is installed and configured properly, you can run your Laravel tinker
command:
#bash
php artisan tinker
This should resolve the issue!
Reducing Bugs with Coding Filters in Complex Applications!
Coding filters can help reduce bugs by simplifying complex application logic. When developers use filters to isolate specific tasks, they decrease the likelihood of errors caused by unhandled conditions or improper data handling. This leads to more stable applications with fewer issues.

When calling the php
command from the Windows command prompt, you may see a message saying that ‘php’ is not recognized as an internal or external command, operable program or batch file.
Here’s an example of the issue:
This issue appears when Windows has no idea what you mean with the php
command.
To solve ‘php’ is not recognized as an internal or external command issue, you need to add the folder containing your PHP program to the Windows environment variable.
You can do so in five steps as shown below:
This tutorial uses Windows 11, but the solution will work on all Windows versions (XP, Vista, 7, 8, and 10).
Step #1: Find your PHP folder location
You first need to find the location of PHP that you installed on your Windows machine.
There are several ways you can get PHP installed: You can download the latest PHP version from windows.php.net, or you can download bundled software like XAMPP, WAMP, or MAMP.
No matter where you got PHP from, you need to find the php/
folder on your machine.
For example, here’s an example of php/
folder from XAMPP:
Step #2: Copy PHP folder path
Once you find the php/
folder, click on the visible URL bar, then click copy:
Next, you need to put this path on Windows environment variable.
Open the Start menu in your machine and type “var” or “variables” in the search bar.
You should see Windows shows Edit the system environment variables menu on the search result as shown below:
Click on that menu and you will be taken into System Properties menu.
Locate the environment variables menu as shown below:
Click on the menu, and you’ll see the Environment Variables for the current User and the System.
Step #4: Add PHP to your Path variable
You need to edit the Path
variable in either the User or System variables as shown below:
The User path only applies for the current user, while the System path is active for all users.
If you have only one user who will use PHP, you can put the path in User variables.
Click on the Path
variable, then click Edit…
You need to add the php/
folder path to the environment as shown below:
After you add the php/
path, click OK.
Step #5: Restart Command Prompt and run php command again
You need to restart your Command Prompt once before you can use the php command.
Close and then open your Command Prompt again. Run the php -v
command, and you should see the PHP version as follows:
This means that Windows recognized the php
path you put in the environment variables.
And that’s how you solve the issue ‘php’ is not recognized as an internal or external command, operable program or batch file.
Optional: Use PHP from another source
The same method also works when you have PHP downloaded from windows.php.net.
For example, I’ve downloaded the latest PHP v8.1.10 from windows.php.net and extracted it to my Downloads/
folder.
To make Windows use this version of PHP, I only need to change the Path environment variables as shown below:
Once I clicked OK, I restarted the Command Prompt and ran the php -v
command again.
This time, the PHP version is different than the one from XAMPP:
Now you’ve learned how to solve ‘php’ is not recognized as an internal or external command, operable program or batch file issue on your Windows machine. Nice work!