Im trying to install Composer.exe, and it always fail after I choose php.exe file and click next, with an error:
The PHP exe file you specified did not run correctly [exit code 1]: D:\Software(x86)\wamp64\bin\php\php7.0.10\php.exe
Program Output: 'D:\Software' is not recognized as an internal or external command, operable program or batch file.
Thing is: Path to the php.exe is valid. I have php in env variables, so if I run cmd and type in php it runs...
But if open cmd and type in path that I gave to the composer so D:\Software(x86)\wamp64\bin\php\php7.0.10\php.exe
It respond with 'D:\Software' is not recognized as an internal or external command, operable program or batch file. too.
To clarify, I restarted computer after php installation and I after added env variables.
And this is in my env path var: ...;D:\Software(x86)\wamp64\bin\php\php7.0.10\
I installed xampp on D:\ Drive and it didnt work too, then I
uninstalled it and istalled it on C:\ and it worked... Dunno what was
the problem, if someone can explain, please do. Thanks
I guess you have to escape the braces in windows. Either with a backslash or the complete folder with quotes
Related
OS: Windows 10
yesterday I install xampp because I want to learn laravel.
everything is normal. I setup laravel and all. and I got to develop some progress.
before I went to sleep, I turn off my laptop.
in the morning, I open my project and run php artisan serve. then I got
'php' is not recognized as an internal or external command,
operable program or batch file.
I try to check my environment. I found that PHP is gone from the environment. so I add PHP (again) in the environment table.
and still, got the same error
'php' is not recognized as an internal or external command,
operable program or batch file.
so I check the path C:/xampp/php. turns out, there is no php.exe
then I run where php.exe from cmd in the directory C:/. and got
C:\>where php.exe
INFO: Could not find files for the given pattern(s).
Is there any solution so I can use PHP again?
I'm trying to install phpunit manually on my windows machine. I don't use composer, so I have to install it manually with a .phar file. I'm following the instructions from the official documentation:
https://phpunit.readthedocs.io/en/latest/installation.html#windows
I've done every step, but it won't work. phpunit --version will throw me the message 'phpunit' is not recognized as an internal or external command, operable program or batch file. Can someone Help me?
I'm using Windows 7 64-bit with XAMPP 3.2.2 and PHP 7.1.1.
EDIT:
My phpunit.cmd file location is C:\xampp\php\phar\phpunit.cmd.
The file contains the code #php "%~dp0phpunit.phar" %*. I've added ;C:xampp\php\phar to my PATH variable.
In order to make Windows recognize any command, you must put the binary's path in the relevant environment variable (PATH). Before that you need to create some kind of file Windows can run natively (i.e. not a .phar – can be a command line / batch file or executable). Here are instructions:
https://phpunit.de/manual/current/en/installation.html#installation.phar.windows
Edit: If following the above instructions, it's also important to make sure that php itself is part of the PATH environment variable, so that it's possible to execute commands like php phpunit.phar.
When I typed php in my command prompt, It results
C:\Users\samsung>php
'php' is not recognized as an internal or external command,
operable program or batch file.
I have installed xampp in my windows 10 and I haven't edited the php.ini file in the settings. Any help to enable this php command would be greatly appreciated because I am stock in my laravel composer setup due to this.
If you are using windows:
Open My Computer Properties
Click on Advance System Setting
Select Environment Variables
Click on Path & Edit
Click new & Add your PHP.exe path (e.g. C:\xampp\php\php.exe)
As shown in the picture
then Restart
Detail Support available here
You should add the php.exe path to PATH environment variable
http://php.net/manual/en/faq.installation.php#faq.installation.addtopath
Install composer, during the installation process allow composer to add php to your path:
https://getcomposer.org/Composer-Setup.exe
I am trying to install Symfony 2.7 as instructed by the manual.
When I open CMD (I am running it as an administrator in Windows 8.1) the default path is C:\Windows\System32. I have tried running the command specified in the documentation there (c:\> php -r "readfile('http://symfony.com/installer');" > symfony), as well as in the root directory, both give me the same error.
I am using WAMP, the appache rewrite module and php_xls are activated.
I've also added the following to the PATH in the environment variables: ;C:\wamp\bin\php\php5.2.5;C:\wamp\bin\mysql\mysql5.0.45\bin
After having added it, I rebooted the computer and still nothing worked. How can I install Symfony 2.7?
Here is the solution to your original problem:
You just have to make sure that the path to your php executable is correct when you add it to your PATH environment variable. This path is probably related to the version of PHP you have. You should be able to find this path by navigating inside your wamp installation and looking for the php folder and binary. In your case, this would be C:\wamp\bin\php\php5.5.12
However, for the new problem you have...
However, I get the error The directory name is invalid when I execute
the following command: c:>projects\ php symfony
You just have to make sure that your PATH is updated with the correct path for your php, and then do this from C:>
php projects\symfony
Note that php is the executable and projects\symfony is the path to the symfony file.
When I run phpunit on the command line I get 'phpunit' is not recognized as an internal or external command, operable program or batch file.
php has been added to my system path.
My php.ini includes include_path=".;C:\PHP\pear".
How can I get the command phpunit to be recognized by the command line?
Make sure your PEAR installation is installed properly and available in the Windows environment. Each PEAR command has a corresponding .bat file in the PEAR installation directory, e.g. phpunit.bat. Because these are the files that get called when doing e.g. phpunit on the command line, this directory has to be on your PATH as well. Having the PEAR directory on the include_path only is not enough.
If you are sure PEAR is installed properly. reinstall PHPUnit with
pear install --alldeps --force phpunit/PHPUnit
You need to add php path (which is C:\PHP) to the PATH variable.
On Windows 7 it will be:
1) My Computer -> Right click -> Properties
2) Advanced System Settings
3) Click "Environment variables" button
4) Find "Path" entry in "System variable" section and:
a) add to the end ";C:\PHP" (without quotes)
or
b) add to the front "C:\PHP;"
EDIT:
php has been added to my system path.
You do need to open a new windows command prompt (no need for logoff, restart...)