I am installing composer for laravel installation.but when it want php.exe file i coudn't find it in c:/xampp/php folder.I set up my path variable c:/xampp/php but it is still not working.help me guys.
If xampp has correctly installed, but you are failing to run PHP it is more than possible that you don't have PHP set in your environment paths.
To set this go to;
Start > right click computer > properties > Advanced system settings > Environment Variables.
Under System variables find a variable named PATH, highlight then click Edit... Append the absolute path to your root PHP folder, this could either be xampps located in.
c:/xampp/php/
Press Ok, once you've finished; close down any command prompt windows you may have open. Re-open command prompt and run php -v. Hopefully at this point PHP has responded with it's version and license information.
Make sure you have xampp properly installed.
If you add c:/xampp/php to your PATH while you have a console open, you need to open another console, in order for the PATH to be updated.
i think I have that problem one day, i solved uninstalling xampp server and reinstalling it, but when xampp ask you wich folder to install you need to create a new folder:
C://new folder/xampp/.......
If you install/uninstall multiples xampp or wampp versions for some reasons create storage info in the xampp folder, so creating a new folder solve the problem.
You can use this path:
c:/xampp/php/php.exe
PATH should be a directory, not a file, so you should set it to "c:\xampp\php\", other than"c:\xampp\php\php.exe"
Related
i'm trying to set the certain path for the php extension in my vscode (using linux)
i started installing the XAMPP
and after it..i tried to use the extension writing some php scripts(php extension INTELLISENSE and DEBUG), but the extension is not working properly and it's showing that error:
Cannot validate since /usr/bin/php is not a valid php executable. Use the setting 'php.validate.executablePath' to configure the PHP executable.
i tried to set it using que path which is provided by vscode documentation, but it's still no working.
Can anyone help me !! please!!!
I found a solution, typing in terminal
'whereis php'
that returns the absolute path for set it in the vscode extension
/opt/lampp/bin/php
Then, setting the path in the follow line
php.validate.executablePath: "/opt/lampp/bin/php",
So, I hope this solution is helping someone behind the screen.
Php path in windows
Typing in terminal
where php
And it'll gives the path as (in my case)
C:\xampp\php\php.exe
Just extending the answer by #Reinaldo Duguet with a ton of thanks to him !
If you are using Xampp, the PHP path can be found by running the local server and then typing localhost in the browser. This will open the Xampp dashboard. Click on phpinfo() and there you will get the exact path shown as
Configuration File (php.ini) Path = /opt/lampp/etc
Please note that the path may very as per the PHP installation in your system. So you may have to use the respective path shown with above ways.
Then, to let VSCode know this path, open settings in VSCode and search for "PHP debug" and click on the PHP > Debug:Executable Path setting
Add the following line at the first place after "{" telling VSCode where PHP is installed in the system.
"php.validate.executablePath": "/opt/lampp/etc",
If you are using Xampp, the PHP path can be found by running the local server and then typing
the correct version C:/xampp/php/php.exe
XAMPP isn't the best option for linux and i wouldn't recommend it.
Assuming this is not the problem, here is how to do :
find php executable
whereis php
Check your vscode installation. You want to make sure it's not using flatpak (it runs in a container and it would mess up everything)
go in vscode settings, search for php and set "php.debug.executablePath": "/your path/php"
If it still doesn't work, this might be a permission problem. Then :
copy the php executable in your user folder
sudo cp original_path/php /your_user_folder/php
add permissions
sudo chmod 777 /your_user_folder/php
If none of above worked, at this point, you may want to use a VM.
I just wanted to add a possibility here that ended up being my issue in case it helps someone else in the future. My issue was that I was using a Debian based distro and installed VSCode through the software app which relies on Snap apparently. Snap runs the programs in a sandbox and prevents them from seeing other locations on the computer. My solution was that I uninstalled the shop version and installed VScode manually via downloading directly from the website. After that, everything works as expected.
I got the following error when I run a command with php
C:\xampp\htdocs>php
'php' is not recognized as an internal or external command,
operable program or batch file.
I don't get any error when I run the command with php in following path:
C:\xampp\php>php //do not got error here
Why I get this error?
'php' is not recognized as an internal or external command, operable program or batch file.
Add C:\xampp\php to your PATH environment variable.(My Computer->properties -> Advanced system setting-> Environment Variables->path (click on edit))
Then close your command prompt and restart again.
Note: It's very important to close your command prompt and restart again otherwise changes will not be reflected.
You need to Go to My Computer->properties -> Advanced system setting
Now click on Environment Variables..
Add ;C:\xampp\php in path variable value
Now restart command prompt DONE!
Note: Make sure you run CMD via run as administrator
You just need to a add the path of your PHP file. In case you are using wamp or have not installed it on the C drive.
Set "C:\xampp\php" in your PATH Environment Variable. Then restart CMD prompt.
You need to add C:\xampp\php to your PATH Environment Variable, Only after then you would be able to execute php command line from outside php_home.
Is your path correctly configured?
In Windows, you can do that as described here:
http://www.computerhope.com/issues/ch000549.htm
For Laragon:
First, download your PHP from [https://windows.php.net/download/]
then unzip your file -> copy folder -> paste this direction:
C:\laragon\bin\php`Your folder`
search from windows
Edit the system environment variables
and then open it.
Click Environment variables...
Click path and Edit
Click New and add the php.exe path
like:
C:\laragon\bin\php`Your folder`
and then press OK for all steps.
restart laragon and vscode
and our problem is already solved.
Here what I DO on MY PC I install all software that i usually used in G: partian not C:
if my operating system is fall (win 10) , Do not need to reinstall them again and lost time , Then How windows work it update PATH automatic if you install any new programe or pice of softwore ,
SO
I must update PATH like these HERE! all my software i usually used
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;G:\HashiCorp\Vagrant\bin;G:\xampp\php;G:\xampp\mysql\bin;G:\Program Files (x86)\heroku\bin;G:\Program Files (x86)\Git\bin;G:\Program Files (x86)\composer;G:\Program Files (x86)\nodejs;G:\Program Files (x86)\Sublime Text 3;G:\Program Files (x86)\Microsoft VS Code\bin;G:\Program Files (x86)\cygwin64\bin
I also got the following error when I run a command with PHP, I did the solution like that:
From the desktop, right-click the Computer icon.
Choose Properties from the context menu.
Click the Advanced system settings link.
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable window, Add C:\xampp\php to your PATH Environment Variable.
Very important note: restart command prompt
Extra info:
If you are using PhpStorm as IDE, after updating the path variable you need to restart PhpStorm so that it takes effect.
Restarting terminal window was not enough for me. (PhpStorm 2020.3.2)
In latest Xampp 8.1.2
PHP path is changed to this below: Set it in your PATH variable.
C:\xampp\php\windowsXamppPhp
Don't forget to restart the PowerShell and run as Administrator.
I faced this issue even with a properly set up windows environment variable. I just needed to close and restart the terminal to solve it.
The previous answers about adding the path to the Env Var are correct, but my case was different.
I needed to downgrade my PHP version to 5 in order to update an old application.
I was using the following combination: MAMP, PhpStorm, the Environment Variable Path was set properly to the MAMP PHP version that I was using
The error was showing in PhpStorm's Terminal
The error was due to the php.ini file using # in the comment
After I replaced "#" by ";" I restarted PhpStorm and recognized the PHP version and the command "php -v" worked again
I have to face the same problem which I solved by adding the path of XAMP/WAMP to PATH environment variable.
Follow these steps:
Go to System Properties
Go to Advanced
Go to Environmental Variables
Edit the Path environment variable
Add the installation path of xammp/wamp like in my case the path is E:\xammp\php
Click on Ok
Restart command prompt (cmd)
Check the version of PHP by running php --version.
Laragon users
you will find your PHP folder in the bin folder of laragon. goto your desired PHP version folder and copy the location. for me it was:
C:\laragon\bin\php\php-7.4.19-Win32-vc15-x64
Add that location on your system PATH:
After that, you need to restart your cmd or terminal.
In my case the problem was in the path, I was giving the path to the php.exe and that's wrong I have to write the path of the root folder...
I restarted CMD program it solves my problem
currently im trying to make backup and restore mysql database in my laravel project. I am using this laravel package https://github.com/backup-manager/laravel for backup package. i already follow the intructions, but when i am trying to backup my local database through command line (php artisan db:backup) in the last question, i got this message.
Dumping database and uploading...
[BackupManager\ShellProcessing\ShellProcessFailed]
'mysqldump' is not recognized as an internal or external command,
operable program or batch file.
I already googling it, and already put C:\xampp\mysql\bin to my windows env variables paths, but i still having this issue. if anybody know how to fix this, please tell me, i really appreciate it.
Laravel 5.1.x
It is because mysqldump.exe is not found in that location, the right path is given bellow
Open Command Prompt and type this
cd C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin
Press Enter
then type
mysqldump.exe
or,
Directly open this directory "C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin" and Press LEFT SHIFT KEY from keyboard and RIGHT CLICK on the Directory Window.
then type
mysqldump.exe
It will work 100% correctly
If you are using Xamp then:
Open your Xamp folder
Go to \mysql\bin find the mysqldump.exe
Go to your environment variables under System variable click on 'New'.
As 'variable name' put 'mysqldump'(without the quotes) and as 'variable value' put the path to your xamp\mysql\bin\mysqldump.exe this will make 'mysqldump' available as a global system alias.
Reminder: Make sure to restart your command-line interface.
It happened with me and I solved it by adding the following line at the top of the .bat file.
cd "C:\xampp\mysql\bin"
Please add C:\xampp\mysql\bin to this path at your user variables and system variables. If you are using a wamp server, add C:\wamp64\bin\mysql\mysql8.0.27\bin this path at your user and system variables.
Note: MySQL version path will change as per your installation.
On my side, I was using PowerShell and I had the same error message.
I had to go inside the directory of MySql. Mine was located in:
C:\Program Files\MySQL\MySQL Server 5.7\bin
Then I had to make sure that I had mysqldump.exe in the bin folder.
And then run this command:
./mysqldump.exe -u root -p yordbName > C:\MySqlDump\sakila.sql
It is late, but I will answer to this question for other people who have the same issue.
You need to add the mysqldump.exe runtime file path to your Windows environment variable. I am using Wamp, the path look like this "C:\wamp64\bin\mysql\mysqlx.x.xx\bin"
Close your command-line interface and try again, It should work.
I am using Xamp and the following step is working:
Copy the path "C:\xampp\mysql\bin"
Go to your environment variables under System variable click on 'Path' and add "New".
Put the path there then click ok.
Restart your command-line interface.
I got the following error when I run a command with php
C:\xampp\htdocs>php
'php' is not recognized as an internal or external command,
operable program or batch file.
I don't get any error when I run the command with php in following path:
C:\xampp\php>php //do not got error here
Why I get this error?
'php' is not recognized as an internal or external command, operable program or batch file.
Add C:\xampp\php to your PATH environment variable.(My Computer->properties -> Advanced system setting-> Environment Variables->path (click on edit))
Then close your command prompt and restart again.
Note: It's very important to close your command prompt and restart again otherwise changes will not be reflected.
You need to Go to My Computer->properties -> Advanced system setting
Now click on Environment Variables..
Add ;C:\xampp\php in path variable value
Now restart command prompt DONE!
Note: Make sure you run CMD via run as administrator
You just need to a add the path of your PHP file. In case you are using wamp or have not installed it on the C drive.
Set "C:\xampp\php" in your PATH Environment Variable. Then restart CMD prompt.
You need to add C:\xampp\php to your PATH Environment Variable, Only after then you would be able to execute php command line from outside php_home.
Is your path correctly configured?
In Windows, you can do that as described here:
http://www.computerhope.com/issues/ch000549.htm
For Laragon:
First, download your PHP from [https://windows.php.net/download/]
then unzip your file -> copy folder -> paste this direction:
C:\laragon\bin\php`Your folder`
search from windows
Edit the system environment variables
and then open it.
Click Environment variables...
Click path and Edit
Click New and add the php.exe path
like:
C:\laragon\bin\php`Your folder`
and then press OK for all steps.
restart laragon and vscode
and our problem is already solved.
Here what I DO on MY PC I install all software that i usually used in G: partian not C:
if my operating system is fall (win 10) , Do not need to reinstall them again and lost time , Then How windows work it update PATH automatic if you install any new programe or pice of softwore ,
SO
I must update PATH like these HERE! all my software i usually used
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;G:\HashiCorp\Vagrant\bin;G:\xampp\php;G:\xampp\mysql\bin;G:\Program Files (x86)\heroku\bin;G:\Program Files (x86)\Git\bin;G:\Program Files (x86)\composer;G:\Program Files (x86)\nodejs;G:\Program Files (x86)\Sublime Text 3;G:\Program Files (x86)\Microsoft VS Code\bin;G:\Program Files (x86)\cygwin64\bin
I also got the following error when I run a command with PHP, I did the solution like that:
From the desktop, right-click the Computer icon.
Choose Properties from the context menu.
Click the Advanced system settings link.
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable window, Add C:\xampp\php to your PATH Environment Variable.
Very important note: restart command prompt
Extra info:
If you are using PhpStorm as IDE, after updating the path variable you need to restart PhpStorm so that it takes effect.
Restarting terminal window was not enough for me. (PhpStorm 2020.3.2)
In latest Xampp 8.1.2
PHP path is changed to this below: Set it in your PATH variable.
C:\xampp\php\windowsXamppPhp
Don't forget to restart the PowerShell and run as Administrator.
I faced this issue even with a properly set up windows environment variable. I just needed to close and restart the terminal to solve it.
The previous answers about adding the path to the Env Var are correct, but my case was different.
I needed to downgrade my PHP version to 5 in order to update an old application.
I was using the following combination: MAMP, PhpStorm, the Environment Variable Path was set properly to the MAMP PHP version that I was using
The error was showing in PhpStorm's Terminal
The error was due to the php.ini file using # in the comment
After I replaced "#" by ";" I restarted PhpStorm and recognized the PHP version and the command "php -v" worked again
I have to face the same problem which I solved by adding the path of XAMP/WAMP to PATH environment variable.
Follow these steps:
Go to System Properties
Go to Advanced
Go to Environmental Variables
Edit the Path environment variable
Add the installation path of xammp/wamp like in my case the path is E:\xammp\php
Click on Ok
Restart command prompt (cmd)
Check the version of PHP by running php --version.
Laragon users
you will find your PHP folder in the bin folder of laragon. goto your desired PHP version folder and copy the location. for me it was:
C:\laragon\bin\php\php-7.4.19-Win32-vc15-x64
Add that location on your system PATH:
After that, you need to restart your cmd or terminal.
In my case the problem was in the path, I was giving the path to the php.exe and that's wrong I have to write the path of the root folder...
I restarted CMD program it solves my problem
‘php.exe’ is not recognized as an internal or external command,
operable program or batch file.
Why does that error occur even though I've added PHP to my environment variables?
My environment variable PATH is shown below:
C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Program
Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\PC
...............
Files\QTSystem\;A:\xampp\php\php.exe
I'm using Windows 7.
A:\xampp\php\php.exe
The PATH environment variable must contain paths only, not file names.
Make that
A:\xampp\php
it is very easy to do
You need to also add php.exe
Adding this path:
windows key + pause
click on Advance system settings
click Environment Variable
System variables part -> Path -> Edit and the add
C:\wamp\bin\php\php5.3.8;
close you cmd prompt if its open
It's Done!
I think you need to change it to A:\xampp\php\ and just leave it there, then it will search the directory for the file, also: have you tried calling just php instead of php.exe and check that the directory is correct.
View above screen shot for setup enviroment variable in window 7
Note:- After setup enviroment variable please restart you computer then its will work fine
Shouldn't the last part be: C:\xampp\php\ ? Unless you remapped your drives, A is the floppy disk. :)
Also, you need to specify the folder, not the exe file itself.
My case am Using Bitnami Ruby Stack apache Web server ,
Pressed Windows key + Pause/Break Button
Clicked advanced system settings
Click Environment Variables
Under System variables > edit PATH variable by adding C:\Bitnami\rubystack-1.9.3-24\php
Click Ok to close the Environment Variable window
Close your command prompt if open
*(Proceed to 7. to confirm if php is installed)
Press Windows Key + R button to open your cmd
Type php -v to view your php version
Set PHP as environment variable from System as below to run it from CMD
1)Windows key + Pause
2)Click on Advanced system settings
3)Now click on Environment Variables.. button
4)In system variable section search for Path and edit it as D:\wamp\bin\php\php5.3.13;(If one needs to append it to some already exits value then start path with;)
5)Now open CMD and run command PHP from any path where you don’t have PHP installed , in my case it’s C drive.
6)We can check above set Path from CMD using Path command also.
If you have installed WAMP server, then your path can vary. For example, I installed WAMP and the path to my php.exe turned out to be:
C:\wamp\bin\php\php5.5.12\php.exe
To make it work, I entered the following path in the PATH variable of the System Variables:
C:\wamp\bin\php\php5.5.12
Once done, I restarted command prompt and everything worked fine.
So the path can vary depending upon how you installed PHP. If you would like to install WAMP server and have it install other essential packages like PHPMyAdmin, etc. you may do so from: wampserver.com
In my case, environment path is C:\ProgramData\Drush\;C:\Program Files (x86)\Drush\Php; and it works for me.
If I simply add C:\xampp\php\ dint work for me.
I hope if someone facing this issue can try this suggestion.
This happened to me and I found why.
Xampp can't run properly depending on your UAC settings.
Try to do this:
Log in as administrator (running cmd.exe as administrator isn't enough)
Execute cmd.exe or equivalent
type php -version