Symfony php.ini Debian - php

I'm using Debian 7 amd64 LAMP server on Oracle VM VirtualBox.
I'm trying to install Symfony and I'm having some lil problems
When I run command:
php my_project_name/app/check.php
It says:
[ERROR]
Your system is not ready to run Symfony2 projects.
Fix the following mandatory requirements:
date.timezone setting must be set > Set the "date.timezone" setting in php.ini* (like Europe/Paris).
I have already tried to edit php.ini file with following command:
sudo nano/etc/php5/apache2/php.ini
and there under [date] section; deleted ; and edited to: date.timezone = Europe/Helsinki
after that restarted.
in http://localhost/phpinfo.php there is correct Timezone.
Default timezone Europe/Helsinki,
(Local Value)
date.timezone Europe/Helsinki,
(Master Value)
Europe/Helsinki
Any tips? May there be another php.ini file Symfony uses?

You are executing the check script via command line, so the php.ini is different between the CLI and apache.
For find the correct php.ini for the cli lauch the following command:
php -i | grep 'php.ini'
And check the Loaded Configuration File line
Hope this help

Related

Unable to install my symfony project

I'm using MAMP for Windows 10 , and I have a problem when I try to make a project with symfony. I install symfony with the installer and when I launch the command "php symfony new my_project_name", the installation doesn't work because of a time zone error.
To find the php.ini, I launch the php info on MAMP and it displays this
"Configuration File (php.ini) Path C:\WINDOWS
Loaded Configuration File C:\MAMP\conf\php5.6.3\php.ini "
and I checked on apache con (C:\MAMP\conf\apache\httpd.conf) for PHPIniDir : PHPIniDir "C:\MAMP\conf\php5.6.3\php.ini"
I modify the timezone parameter as follows
[Date]
; Defines the default timezone used by the date functions
date.timezone = Europe/Paris
and I launch the check but it seems that I didn't modify the right file. Also, there is a problem with my php.in; the following errors occur
Symfony2 Requirements Checker
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> PHP is using the following php.ini file:
WARNING: No configuration file (php.ini) used by PHP!
> Checking Symfony requirements:
.....E................W...WW.W.....
[ERROR]
Your system is not ready to run Symfony2 projects
Fix the following mandatory requirements
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* date.timezone setting must be set
> Set the "date.timezone" setting in php.ini* (like Europe/Paris).
Usually, the PHP CLI uses a different php.ini configuration than the Apache PHP. Could you check where is the right configuration file for command line? This topic can help you.
Then when you'll find it, just do the same as you did with the MAMP php.ini. It should work.
Find PHP.INI file for CLI like this:
hp -i |grep php.ini
and then modify date.timezone in it. Voila! It worked for me.

what php.ini does symfony2 cli-commands use?

I'm running a console command for symfony sudo php app/console assetic:dump and it is showing Warnings even though I specifically ignore Warnings on the php.ini for apache and for cli.
Is it using a different php.ini altogether?
Do sudo php -i for a readout of your PHP settings, including the path to php.ini.
Run the following command:
php -i | grep .ini
and you will see the full path of the php.ini used by cli.
Don't use sudo when dumping assets as the owner of the created files will be "root" and the nginx/apache user will not be able to use them.
Yes, it is probable that php used on the command line uses a different php.ini than php in apache.
Specifically in wamp server, php cli uses the php.ini in the php directory, and php as apache module uses php.ini situated in the apache/bin folder.

Error with date.timezone in php.ini

I'm trying to install a Symfony project on a new mac and I keep having this ErrorExeception:
[ErrorException] 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 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.
I have already verified my PHP version using phpinfo();.
The path for my php.ini is /Applications/MAMP/bin/php/php5.5.10/conf
I opened my php.ini and I changed the date.timezone to date.timezone = "Europe/Paris"
I restarted my MAMP many times and I keep having the same Error
I also noticed that I have a php.ini.temp in the same folder. I also changed the date.timezone in this file but it still doesn't work.
Does anyone have an idea about what is happening?
Thanks!
You should simple add to your Symfony controller :
phpinfo();
and you will know where your php.ini is located and you should make sure you changed value in this file.
You should also consider setting timezone in your script:
date_default_timezone_set('Europe/Paris');
because you (or someone else) may simple change it in future to other timezone
Symfony uses php command line (CLI) to make the install, so editing /etc/php5/apache2/php.ini will make no effect.
Try editing php-cli config. On debian:
vim /etc/php5/cli/php.ini
date.timezone = "Europe/Paris"
/etc/init.d/apache2 restart
I was installing Sylius and got into this similar issue.
I have changed the timezone in the php.ini which I got from phpinfo() script.
The configuration file location was: /etc/php/7.4/fpm/php.ini
Even after that, Sylius install reported the same issue. So, I followed the below steps.
Ran php -i | grep timezone:
Default timezone => Asia/Calcutta
date.timezone => no value => no value
Ran php -i | grep php.ini:
Configuration File (php.ini) Path => /etc/php/7.4/cli
Loaded Configuration File => /etc/php/7.4/cli/php.ini
After updating the value in the above CLI config file, everything went smooth.
$ su root
Enter root password
$ vim /etc/php.ini
Edit the timezone in this file

Can't set/find detect_unicode to Off

I'm want to start using phpDocumentor and the manual installation keeps throwing an error about me not having set detect_unicode = Off in my php.ini in Terminal.
When I add it to my php.ini it doesn't take and I get the same issue when running the install. Nobody seems to have this problem, and for the life of me I can't figure it out.
https://github.com/phpDocumentor/phpDocumentor2/blob/develop/README.md#installation
What am I missing? (I did restart the MAMP server after the php.ini edit)
Screenshot of the error in terminal...
If you have MAMP/MAMP Pro installed then the problem is that the PHP version available to your terminal will most probably be the system version located in:
/private/etc/
I had the same problem but in my case I didn't have a php.ini file in that directory so the best way to resolve it is to just create a symbolic link to the PHP version currently in use in your MAMP/MAMP Pro installation:
php.ini -> /Applications/MAMP/bin/php/php5.3.14/conf/php.ini
That solves the issue. Just change the php version php5.3.14 to whatever version of PHP you've selected to use in MAMP.
As #moderndegree mentions above, you can then optionally make this available to the terminal in the future by editing your path variable in your bash/zsh/etc:
export PATH="/Applications/MAMP/bin/php/php5.3.14/bin:$PATH"
You must not be editing the right php.ini if it still is enabled. Run php -i | grep ini to find all the ini files that are loaded.
The relevant lines are those two:
Loaded Configuration File => ...
Additional .ini files parsed => ...
The problem is that you are probably hitting a different php install.
Try the following:
which php
If you get anything other than, /Applications/MAMP/bin/..., you need update your environment to point to MAMP's installation.
To do this, you will need to add the following to .bash_profile (please update the path to match your setup):
export PATH="/Applications/MAMP/bin/php/php5.3.6/bin:$PATH"
Reload .bash_profile with the following command:
source .bash_profile
After you do this, you should be pointing to the correct php installation. Try which php again to confirm. Now run php -i | grep ini to confirm that the correct php.ini file is being loaded. As Seldaek stated, the relevant lines are:
Loaded Configuration File => ...
Additional .ini files parsed => ...
As I remember, MAMP uses configuration templates. So you should edit php.ini template. The actual php.ini will be regenerated from the template everytime you restart MAMP.
I faced the same problem for composer-php and i add this line manually into php.ini file. Like this:
sudo /private/etc/php.ini
then add this line "detect_unicode = Off"
detect_unicode = Off
then its work and i installed composer. You can see this
How to disable "detect_unicode" setting from php.ini? (trying to install Composer)
If you can't change your /usr/local/bin/php/php.ini file, remember to keep using '-d detect_unicode=Off' for all your php calls like so:
curl -s https://getcomposer.org/installer | php -d detect_unicode=Off
php -d detect_unicode=Off composer.phar install
If you are able to change your php.ini file, then add the following to the end of your php.ini:
detect_unicode = Off

NuSphere remote debugger dbg-php-5.3.so says it's not installed

just getting into php. Trying to get NuSphere remote debugging working. I am coming from VS background so i like that NuSphere is c compiled and not java.
Ok so if you use NuSphere maybe you can help me. I've dumped the dbg-php.5.3.so file in my extensions directory. I've modified my php.ini file:
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20090626/dbg-php-5.3.so"
[debugger]
debugger.enabled=on
debugger.profiler_enabled=on
the file is found.. except when i restart the webserver and run phpinfo (from my user account on a WHM/Cpanel server) the module does not show as being loaded??
I am using the trial version.. not sure if that matters.
This is what I did:
Login to SSH and type php -i | grep php.ini
This will give you the path to the php.ini file you need to edit, on this system it happens to be /usr/local/lib/php.ini (Running CentOS 6 x86_64 with WHM/cPanel).
Edit /usr/local/lib/php.ini and search "extension_dir" which will give you the path to place dbg-php-5.3.so, on this system it happens to be /usr/local/lib/php/extensions/no-debug-non-zts-20090626. Add the .so file there and continue to modify your php.ini file with the debugger options.
To test the the debugger is being loaded I restart httpd "service httpd restart" and then "php -v" to verify the extension loaded properly.
I hope this helps!

Categories