1
votes

I work on Windows and want to use some linux commands in console. I decided to install CygWin. I run my local server on Xampp.

When I open cygwin console and type php -v i see that is a version installed with cygwin. How to change configuration to cygwin use php from Xampp ?

I run Symfony project on local server and when I use xampp console all commands works fine, but when I open cygwin console and try to type some cmd for symfony there an error appear:

$ 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 version: PHP 5.6.15 (cli)
  • xampp php version: PHP 5.5.27 (cli)

I suppose that cygwin php is wrongly configured thats why I want to use PHP from xampp dir.

1
In your php.ini, find date.timezone, it's usually commented. Uncomment it and set your local timezone, for example Europe/Warsaw. Here is a list of all supported timezones. - Oldskool
thanks for answer, there is a way to modify all the files from cygwin but it would be very long way and many more errors will apear like: for composer: PHP Fatal error: Class 'Phar' not found in /cygdrive/c/ProgramData/ComposerSetup/bin/composer.phar on line 23 for Symfony Commands: [RuntimeException] PHP's json extension is required to use Monolog's NormalizerFormatter In normal xampp console everything works fine, only in cygwin console errors shows up, please help me to change patches - Radek S
Try to read the errors and act accordingly. For example PHP's json extension is required means you should load the JSON extension. It comes with XAMPP, it's just disabled by default. Find the line ;extension=json.dll (or something like that) in the php.ini file and uncomment it. - Oldskool

1 Answers

4
votes

I found answer somwhere else. Posting for others. Maybe someone will use this tip also.

The way to change PHP from CygWin default to Xampp one is to type in CygWin console a command:

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

After that Cygwin use the PHP engine from Xampp

If u want to use this PHP everytime you can edit a CygWin file src/bash.bashrc

and at the end line add this

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

Thats solved my problem and now I use much better Cygwin console for work.