I am having a lot of difficulty routing PHP to cygwin.
My goal is simply to run the following PHP test command successfully:
php -v
I'm currently getting the following error: -bash: php: command not found
This is what I tried in the .bash_profile document:
PATH = $PATH:/xampp/php
export PATH
I am using xampp and my php.exe is in the following path C:/xampp/php/php.exe, also I noticed there isn't a bin directory in my php directory. There is a bin directory in C:/xampp/apache perhaps this is the one I should link to? I tried this as well with no success.
In Cygwin you windows C drive is mounted to /cygdrive/c/ so if you wanted to add C:/xampp/php/ to your path, then you should add the following to your .bashrc:
export PATH=$PATH:/cygdrive/c/xampp/php
What #flungo wrote was absolutely correct:
I have to add this line to C:\cygwin64\etc\bash.bashrc in order for each new cygwin terminal to have the correct $PATH
export PATH=$PATH:/cygdrive/c/xampp/php
Related
So I have installed MAMP and I am using PHP, however I also used Terminal with PHP as well. Now for some reason Terminal is not working with PHP anymore, for example:
Terminal / PHP command not found
So basically I can not work with anything at the moment. I have also simplified .bashrc and .bash_profile.
Terminal and PHP not found
Thanks. mac-machine
cd ~ && nano .zshrc
Add the path of php in .zshrc like:
export PATH=/Applications/MAMP/bin/php/php8.0.8/bin:$PATH
Then run source .zshrc and run php -v to confirm path setup
The problem is working with PHP command line is not found with ZSH, it gets a message: zsh: command not found: php.
So working with older BASH instead of ZSH it works fine.
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.
Good morning all,
I have a little problem with variable $PATH in my .bash_profile file.
I have an OSX system with XAMPP installed.
I have edit my .bash_profile in this way:
export XAMPP_HOME="/Applications/XAMPP/xamppfiles"
export PATH="${XAMPP_HOME}/bin/php-5.4.22:${PATH}"
export PATH="$PATH:/Users/alessandrominoccheri/Sites/site.com/lib/Cake/Console"
export PATH
After I have restart apache and write into console:
source ~/.bash_profile
and type:
which php
But always return me:
/usr/bin/php
How can I change path?
I have changed permission on bin folder but same problem.
I have followed this link but I have the same problem:
Mac OSX PHP and XAMPP path issue
If ${XAMPP_HOME}/bin/php-5.4.22 is the executable, then adding it to your path doesn't help you in being able to call it using php. The $PATH needs to contain directories in which executables are, which will be searched in the order they're defined whenever you mention any executable by name.
You either want to alias your php-5.4.22 to php in your profile, or maybe better, create a symlink for it that overrides your default php. E.g.:
$ ln -s ${XAMPP_HOME}/bin/php-5.4.22 /usr/local/bin/php
I'm trying to create a new yii app from the terminal. My YiiRoot folder is in my htdoc folder. I'm first going into my webroot:
$ cd /Applications/MAMP/htdocs
I'm then going into yiic and trying to create a new application:
/Applications/MAMP/htdocs/YiiRoot/framework/yiic webapp demo
I'm then getting this message:
env: php: No such file or directory
I've also tried:
cd /Applications/MAMP/htdocs/YiiRoot/framework
yiic webapp /Applications/MAMP/htdocs
-bash: yiic: command not found
And:
cd /Applications/MAMP/htdocs/YiiRoot/framework
./yiic webapp /Applications/MAMP/htdocs
No such file or directory
And:
cd /Applications/MAMP/htdocs/YiiRoot/framework
php yiic webapp /Applications/MAMP/htdocs
-bash: php: command not found
And:
cd /Applications/MAMP/htdocs/YiiRoot/framework
php yiic.php webapp /Applications/MAMP/htdocs
-bash: php: command not found
I'm completely out of ideas. Any advice please?
You have to install the php-cli package for your disro.
As it turns out, my particular problem was that php was somehow erased of my system. When I typed find /usr -name php into the terminal there was no indication that the /bin/php file existed. So I asked another question on stackoverflow in an attempt to trouble shoot my php command line problem. So the answer to this question is actually the answer to that question which can be found HERE.
This is pretty common. You need to edit the file Yiic.bat, which is in the folder yii/framwork. There you'll find the line
PHP_COMMAND
Its predifine value usually is just "php.exe". Change that value to the actual address of your php.exe file. Assuming you have a MAMP installation, you could find the php.exe file in the mamp/php/ folder, so the value to PHP_COMMAND would be:
root:/address_to_mamp/mamp/php/php.exe
My system has two PHP interpreters. One came bundled with the OS and the other I installed via the XAMPP package. All of my PHP extensions are applied to the XAMPP installation but PHPUnit seems to only run the version of PHP that came with my machine.
Does anybody know of a way I can configure or rebuild PHPUnit so that it uses my XAMPP PHP interpreter exclusively?
For Mac/Linux, the first line of the phpunit script with starts with
#!/usr/bin/php
change that to
#!/Applications/XAMPP/xamppfiles/bin/php
or whatever other php interpret you want to use.
Find the folder you installed PHPUnit in. There should be a file called phpunit.bat. It should have a line that reads something like
set PHPBIN="C:\php\php.exe"
%PHPBIN% "C:\php\phpunit" %*
Change it to read
set PHPBIN="C:\xampp\php\php.exe"
%PHPBIN% "C:\xampp\php\phpunit" %*
Or whatever the path to your PHP executable is
Since modifying phpunit file did not work for me because of phar signature errors, I was running phpunit with different php version by calling interpreter explicitly (on Linux):
php7.1 /usr/local/bin/phpunit
php5.6 /usr/local/bin/phpunit
Following the example with XAMPP, full path to php interpreter could be provided:
/Applications/XAMPP/xamppfiles/bin/php /usr/local/bin/phpunit
In agreement with Thomas' statement, additionally there's a line further below
if (strpos('/Applications/MAMP/bin/php5.3/bin/php', '#php_bin') === 0) {
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
}
That I've been told you're also supposed to change to reflect the PHP you're interested in using
(I've set mine to MAMP obviously)
I've switched back and forth from 5.2 and 5.3 a lot recently :)
This applies to phpunit installed using Homebrew on Mac OS 10.9. I’ve editing the file located at /usr/local/Cellar/phpunit/4.2.6/bin as seen below. CAVEAT: I don’t know how Homebrew will handle this on a PhpUnit update, but for now it’s working to be able to select the php version that PhpUnit is using for it's testing.
#!/usr/bin/env bash
php=/Applications/MAMP/bin/php/php5.3.14/bin/php
#php=/Applications/MAMP/bin/php/php5.4.4/bin/php
/usr/bin/env $php -d allow_url_fopen=On -d detect_unicode=Off /usr/local/Cellar/phpunit/4.2.6/libexec/phpunit-4.2.6.phar $*
On Windows, this may be achieved using a similar approach to the ones mentioned in other replies.
In your /path/to/composer/phpunit directory, open the phpunit file in an editor. The first line should look like this:
#!/usr/bin/env php
Simply download your desired version of PHP for Windows, place the contents of the ZIP file somewhere to your liking, and reference the fully quantified path to the php.exe file, instead of just php. Like so:
#!/usr/bin/env /c/misc/php-5.5.9-nts-Win32-VC11-x86/php.exe
In my case, I put it in /c/misc/php-5.5.9-nts-Win32-VC11-x86/, which corresponds to C:\misc\php-5.5.9-nts-Win32-VC11-x86\ using Windows path syntax.
Remember to verify that the correct php.ini file is being used (php --ini or in a script file php_ini_loaded_file()).