Timezone with symfony 2 - macos

I've got some troubles whith Symfony 2, trying to generate schema via :
php console/app generate:schema:create
I've got a pretty error :
[Exception]
DateTime::__construct(): 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 'Europe/Berlin' for 'CEST/2.0/DST' instead
Thus, I'm trying to change the timezone in my php.ini with
date.timezone = 'Europe/Paris'
but even if I'm reloading my apache, I still get
date.timezone Europe/Zurich Europe/Zurich
if I look at my phpinfo(), so I don't really know what should I try next ... And I'm not even sure that I'm in the good way.
Thanks for helping me

On mac, if you have /etc/php.ini.default, do
sudo cp /etc/php.ini.default /etc/php.ini
and then do
php --ini
to see that it now loads a php.ini file.

this that trick
and se /etc/php5/cli/php.ini and /etc/php5/apache2/php.ini
datetime = 'America/Lima' for example
and run command
$ sudo apt-get install php5-sqlite
$ sudo /etc/init.d/apache2 restart

Some third-party distributions of PHP (including MAMP) have hard-coded the timezone. For instance, MAMP 2.0 is hard-coded to Europe/Berlin, and there is no way to change this. Even changing the value in the php.ini template has no effect, because MAMP overwrites your value. Are you using PHP from source, a pre-compiled package, or PHP as a part of some kind of LAMP stack?

If you are on debian based, you must modify the parameter in the file /etc/php5/cli/php.ini, changing it in /etc/php5/apache2/php.ini has no effect.

I know this is an old ticket, but since I was having a problem with this too, and it's still open I thought I'd share my quick 'n' dirty solution:
In my case, date.default was not set at all and I wasn't in a position to change php.ini. So, as a stopgap I added date_default_timezone_set('Europe/Dublin') at the start of web/app.php to change the timezone at runtime, which worked nicely for me.
If you're using the console to run any commands you will probably have to add the call to the the top of this script also.

I ran into this problem with my shared host. they told me I couldn't change time zones via php.ini, but you can try an .htaccess file instead.
create the .htaccess in the folder where Symfony is installed and put the following code in it:
SetEnv TZ America/Sao_Paulo
hope this helps.
cheers,
Luciano

For Windows, I installed XAMPP for the webserver and downloaded PHP and installed it so that I could run the symfony commands from command prompt.
In this case, the php.ini file used when I execute a Symfony command is located in C:\Program Files(x86)\PHP\php.ini. You have to have admin rights in order to edit this file, so I launched Notepad++ as administrator and opened the file.
Look for date.timezone and modify it according to your timezone e.g. date.timezone = Africa/Nairobi. Timezones are listed on the php website, just search php, timezones. No need to restart your computer or webserver.

I just encountered this problem with XAMPP on Mac 10.11.5, PHP 5.6.8
My error read "Warning: date_default_timezone_get(): Invalid date.timezone value 'America/Los Angeles',"
I fixed it by finding the only problem was the missing underscore in the "Los Angeles" entry for my PHP.ini date.timezone setting.

Try to execute this command:
sudo ln -s /usr/local/php5/lib/php.ini /etc/php.ini
Mac in my case.
First - config path, second - don't change.

Related

Magento command not working on ssh terminal

I logged in to my terminal for run the magento command,after login to ssh on my command prompt and hit the command,and its not returning anything.
here is the command
[root#new-mt5 dev.ia****nce.com]# php bin/magento indexer:reindex
[root#new-mt5 dev.ia****nce.com]#
after hitting the command it not returning anything, I am using this command to my magento root dir.
how to solve this issue?
Follow this steps:
Try to check the env.php file . check if all the environment settings are correct. make sure your SQL server is running.
try to check the files permission check this docs -> Filesystem permissions
Make sure you PHP version are compatible with your M2 version.
Try to remove cache rm -rf var/cache var/page_cache generated/code generated/metadata
are you on the right directory? check if the magento binary is there. you can do this by listing bin directory (ls bin/)
I know this is old, but this can help someone else
Check your php.ini for memory limits.
You can put something like 6g for a better performance or event -1 for maximum available memory.

how can i delete git from $PATH or change path so that it no longer contains it (macOS)

I have recently updated git and it has changed my path to
/usr/local/git/bin:/usr/local/bin:/usr/local/sbin:/matthew/git
I try to use composer and execute files and I get the error
env: php: No such file or directory.
when
I reset the path back to
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
everything works fine and composer loads but the only thing is it automatically sets the path back to /usr/local/git/bin:/usr/local/bin:/usr/local/sbin:/matthew/git in a matter of seconds after me doing what I need to do.
i thought the path would stay and go back to the original one i reset it to but it auto reverts back to the git one
Is there any way i can fix this without having to reinstall the operating system? and keep the path as PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" i have been stuck on this for two days i just want rid of git
you should update your .bash_profile file
you can check this guide for futher details
#funkyjelly thanks but this was still no good ended up having to reinstall the operating system and install git via home brew and the problem with the path was solved

Installing Blackfire prob issue

Having some issue trying to get Blackfire.io set up on my homestead box.
Followed the installation guide a couple of times now, and no having no errors.
When I try to use the chrome companion I get the follow error ...
Are you authorized to profile this page? Probe not found, invalid signature
Also when I try to check out what version of the prob I am using via php --ri blackfire I get the follow message despite installing it as per the guide
Extension 'blackfire' not present.
Any ideas!?
Many thanks!
in my case (i'm using vagrant) this helped:
in file
/etc/php5/mods-available/blackfire.ini
add
extension=blackfire.so
In my case, I had to check the black-fire agent status, and when I found out it was not active I restart it and it works fine.
To check the status:
sudo /etc/init.d/blackfire-agent status
To restart :
sudo /etc/init.d/blackfire-agent restart
I had the same problem when installing blackfire probe as mentionned in the official documentation. And here is how i solved it.
Since I am using MAMP's php in my terminal i installed the PHP Probe manually instead of installing it with homebrew.
In fact in the first place i tried to instal it with homebrew and that's how i get the same error as you :
When i run this command :
php --ri blackfire
I get :
Extension 'blackfire' not present.
To fix this issue i had to install the probe manually by following theses steps:
download the probe library as mentionoed in the blackfire doc
You should have a file like this : blackfire-php-**********.so
rename it to: blackfire.so
execute this command in your terminal, it should tell you where you can put the downloaded file:
php -i | grep 'extension_dir'
move the blackfire.so file to the mentionned directory.
Close all your terminal windows and restart mamp
Execute php -m in your terminal; if you can see blackfire in the list that means that your extension is working correctly.

Does reinstalling Macports remove/destroy contents of /opt/local/ directory structure?

I'm running a MacPro G5 w/ 10.5.8. I ran:
sudo port selfupdate and then ran:
sudo port upgrade outdated
When it was all finished, I rebooted and apache2 was broken and would not serve PHP file any longer. If I replace the httpd.conf file, it will serve html files.
I finally gave up and restored the backup and the machine is running again. The problem is I have a second machine that I did the same thing on and don't want to go through the same process. I've read several posts about uninstalling/reinstalling Macports like this one from Kirk Roybal How to do a clean reinstall with macports?, but it doesn't say if this process will destroy or reset the contents of the /opt/local/ directory. Especially the MySQL DBs and htdocs contents. Does anyone know if this process is linked or destructive? I'll make backups of everything, of course, before trying anything.
SOLUTION:
I got it to work by making the php53 install work instead of going backwards. Here's what I did:
sudo port select --set php php53 (set MacPorts to use php53 instead of php5)
sudo port installed (Check to make sure php53-apache2handler is installed)
sudo port install php53-apache2handler (It wasn't and yours probably isn't either)
once that's done installing
php -v (check the version of PHP that's running)
cd /opt/local/apache2/modules
sudo /opt/local/apache2/bin/apxs -a -e -n php mod_php53.so (activates php within apache)
this should append
LoadModule php5_module modules/mod_php53.so
to your /opt/local/apache2/conf/httpd.conf file (check it now)
There will also be a line like this
LoadModule php5_module modules/mod_php5.so
Comment it out or remove it so is doesn't interfere with new install
It should also move a copy of mod_php53.so to
/opt/local/apache2/modules
If it's not there, see php53-apache2handler install above.
Check your httpd.conf file for errors
/opt/local/apache2/bin/httpd -S
Finally, create/edit php.ini file to tell apache2 how to connect to MySQL database
cd /opt/local/etc/php53
sudo cp php.ini-production php.ini (for production machine use development for dev machine)
sudo cp php.ini php.ini.bak
Add the default socket paths to php.ini
pdo_mysql.default_socket=/opt/local/var/run/mysql5/mysqld.sock (may vary based on MySQL version. Check the /opt/local/var/run directory if not sure)
mysql.default_socket=/opt/local/var/run/mysql5/mysqld.sock
mysqli.default_socket=/opt/local/var/run/mysql5/mysqld.sock
If you are having problems connecting to MySQL, check for typos in the above paths FIRST. Trust me it will save you tons of time!
If all went according to plan, you should be able to restart the machine, test to make sure all ports started automatically and things should be working.
The files that you add (eg: MySQL DBs) are not destroyed by an update. If you modify files that are managed by MacPorts (eg: they are listed in 'port contents '), then those modifications will be clobbered by an update.
Some projects install config files as examples and have the user make the real config file so as to not clobber it with an update. It looks like the apache2 port follows this pattern. It installs /opt/local/apache2/conf/original/httpd.conf and then copies it to the real location of /opt/local/apache2/conf/httpd.conf at activation time only if the file does not exist.

Installing sensu, sensu-dashboard does not install

I am installing a sensu server inside a docker container running ubuntu 14.04 but when I install it for some reason it does not install the sensu-dashboard.
When I run the following command to set up the defaults I get a file does not exist error
> Command: update-rc.d sensu-dashboard defaults
Error: update-rc.d: /etc/init.d/sensu-dashboard: file does not exist
I have searched for the file but does not seem to be installed anywhere.
Has anyone else had this problem before when installing sensu or know how to fix it?
Thank you
The default Dashboard was removed on July 28th so you missed it by a day!! :( You now have to use a different dashboard. Uchiwa is a great choice and is under very heavy development, so I am sure it will continue to become more feature rich.
link to uchiwa's github page
The default Dashboard was removed that is true but if want to use sensu-dashboard then go for Sensu-Enterprise.
Here is the link: http://sensuapp.org/enterprise

Resources