Cygwin 和 Xampp,使用了错误的 PHP

Cygwin and Xampp, wrong PHP is being used

我在 Windows 上工作,想在控制台中使用一些 linux 命令。我决定安装 CygWin。 我 运行 我的本地服务器在 Xampp。

当我打开 cygwin 控制台并输入 php -v 时,我看到这是与 cygwin 一起安装的版本。如何将配置更改为 cygwin 使用 Xampp 中的 php?

我在本地服务器上 运行 Symfony 项目,当我使用 xampp 控制台时,所有命令都工作正常,但是当我打开 cygwin 控制台并尝试为 symfony 输入一些 cmd 时,出现错误:

$ php app/console debug:router    

[Symfony\Component\Debug\Exception\ContextErrorException] Warning: date_default_timezone_get(): It is not safe to rely on the system' s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those me thods and you are still getting this warning, you most likely misspelled th e timezone identifier. We selected the timezone 'UTC' for now, but please s et date.timezone to select your timezone.

我想 cygwin php 配置错误,这就是为什么我想使用 xampp 目录中的 PHP。

我在其他地方找到了答案。为他人发帖。也许有人也会用到这个技巧。

将 PHP 从 CygWin 默认值更改为 Xampp 的方法之一是在 CygWin 控制台中键入命令:

export PATH=/cygdrive/c/xampp/php:$PATH

之后 Cygwin 使用来自 Xampp

的 PHP 引擎

如果你想在每次编辑 CygWin 文件时都使用这个 PHP src/bash.bashrc

并在最后一行添加

export PATH=/cygdrive/c/xampp/php:$PATH

这解决了我的问题,现在我使用更好的 Cygwin 控制台来工作。