0

I am trying to install Symfony on my Mac. Using the Terminal I have carried out the first three lines of the guide:

sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony

sudo chmod a+x /usr/local/bin/symfony

symfony new my_project_name

This started to download the files and then I got this message:

Preparing project... Warning: date(): 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 methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php on line 283 ✕ Symfony 3.2.8 was successfully installed but your system doesn't meet its technical requirements! Fix the following issues before executing your Symfony application:

  • date.timezone setting must be set

    Set the "date.timezone" setting in php.ini* (like Europe/Paris).

I've tried to find the php.ini file but it doesn't appear in a search.
So, where can I find it and if it is a hidden file - how do I unhide it?

Thanks

SarahNS
  • 1
  • 4
  • Thanks to everyone for trying to help. I have not figured out how to set this up correctly and instead I have installed a VM, which now leads on to a host of other issues ... – SarahNS May 24 '17 at 09:04

3 Answers3

0

You should find it in /private/etc if it exists, otherwise:

sudo cp /private/etc/php.ini.default /private/etc/php.ini

https://stackoverflow.com/a/9343210/7888593

Or to answer your question,in terminal.app type

php --ini

  • Thanks for the reply. I tried php --ini as above and got:Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) But, I still don't know where this is or how I can open it? – SarahNS May 22 '17 at 12:42
  • @SarahNS as seen in result, you have file in /etc/, the loaded one is php.ini and none ovewrite. Good. Now open like that > open -a TextEdit filename filename as /etc/php.ini I think. Not sure so make return :) – Valentin Silvestre May 23 '17 at 09:03
  • OK so I checked php info and it said: /Applications/XAMPP/xamppfiles/etc/php.ini I checked this and it has got Europe/London but the Symfony requirements is still showing a time zone error. I just don't know what is going on and what to do! – SarahNS May 23 '17 at 10:29
  • Are you sure that php.ini isn't located at just /etc/php.ini and not in /Application/etc.. ? You have restarted Apache ? It's needed to reload php conf if I'm not wrong. A last point, XAMPP don't have a GUI to show php.ini instantly ? – Valentin Silvestre May 23 '17 at 12:00
  • Where is /etc/php.ini? – SarahNS May 23 '17 at 12:09
  • With XAMPP, the php.ini file is called php Click on the file called php then you will see another folder called php, click on that, this is the php.ini file – Valentin Silvestre May 23 '17 at 12:20
0

In your Terminal just type the following:

php -i | grep ini

There you can see which php.ini is used (including the full path)

Your webserver might use a different ini but the installation should work.

Joe
  • 2,356
  • 10
  • 15
  • OK so I ran that. It said it was in /etc, so I guessed that was camp/xamppfiles/etc. I checked and it had a date time of Europe/Berlin. I changed it to Europe/London. Ran the Symfony requirements line and it still gave me the same issue. So maybe that isn't the right php.ini? – SarahNS May 22 '17 at 13:16
  • No it literally means the directory is /etc. You don't have much experience in *nix based filesystem structure i guess. You have 2 options to edit this file. It's important to edit the file as sudo so in your terminal you could use `sudo nano /etc/php.ini` . To view the folder in Finder, open finder and press: Shift + CMD + G then type /etc in the popup and go to the folder. Also here your editor should run as sudo (administrator) user otherwise it will be write locked. – Joe May 22 '17 at 13:24
  • No, I've been on Windows for a long time! I ran that, edited it and then checked the requirements again and it still gives me the same error! – SarahNS May 22 '17 at 14:01
  • Hm are you sure the changes to the file were saved? To confirm you could run `php -i | grep date.timezone` if it says no value then probably one of 2 things happened, either the changes to the file were not saved or something overwrites the php.ini setting. You run the Requirements Check on console? IF you run it through a webserver there's the possibility it uses a different php.ini. To check which one you could put a php file into your webroot with the content of the answer below and open this file in a browser, there should be an information which php.ini is used. – Joe May 22 '17 at 14:19
  • It looks like something might be overriding it. I tried phpinfo but when I navigated to the page it said access denied. Not sure why. – SarahNS May 22 '17 at 14:23
  • That's the setup of your apache not php itself. with xampp there should be some public directory where the xampp default page is stored (usually that's what shown when you access localhost while xampp is running). you should put the file in there and be able to open it though http://localhost/whateveryoucalledit.php – Joe May 22 '17 at 14:26
0

You can find it also by adding

<?php phpinfo(); ?>

anywhere in a php file

This way you are sure to get the php.ini used by your project and not by your computer

t-n-y
  • 1,201
  • 2
  • 13
  • 27