我有一台较新的 Ubuntu 16.04 服务器,正在安装基于 Symfony 的应用程序。它说date.timezone
需要设置。好吧,我以前做过。PHP 配置为 FPM,因此它应该是php.ini
文档根目录上的本地,对吗?在那里设置date.timezone
没有用。
phpinfo()
说.ini
读取的文件是:
Configuration File (php.ini) Path /etc/php/5.6/fpm
Loaded Configuration File /etc/php/5.6/fpm/php.ini
Scan this dir for additional .ini files /etc/php/5.6/fpm/conf.d
Additional .ini files parsed /etc/php/5.6/fpm/conf.d/10-mysqlnd.ini,
/etc/php/5.6/fpm/conf.d/10-opcache.ini,
/etc/php/5.6/fpm/conf.d/10-pdo.ini,
/etc/php/5.6/fpm/conf.d/15-xml.ini,
/etc/php/5.6/fpm/conf.d/20-calendar.ini,
/etc/php/5.6/fpm/conf.d/20-ctype.ini,
/etc/php/5.6/fpm/conf.d/20-curl.ini,
/etc/php/5.6/fpm/conf.d/20-dom.ini,
/etc/php/5.6/fpm/conf.d/20-exif.ini,
/etc/php/5.6/fpm/conf.d/20-fileinfo.ini,
/etc/php/5.6/fpm/conf.d/20-ftp.ini,
/etc/php/5.6/fpm/conf.d/20-gd.ini,
/etc/php/5.6/fpm/conf.d/20-geoip.ini,
/etc/php/5.6/fpm/conf.d/20-gettext.ini,
/etc/php/5.6/fpm/conf.d/20-iconv.ini,
/etc/php/5.6/fpm/conf.d/20-imagick.ini,
/etc/php/5.6/fpm/conf.d/20-json.ini,
/etc/php/5.6/fpm/conf.d/20-mbstring.ini,
/etc/php/5.6/fpm/conf.d/20-mcrypt.ini,
/etc/php/5.6/fpm/conf.d/20-mysql.ini,
/etc/php/5.6/fpm/conf.d/20-mysqli.ini,
/etc/php/5.6/fpm/conf.d/20-pdo_mysql.ini,
/etc/php/5.6/fpm/conf.d/20-phar.ini,
/etc/php/5.6/fpm/conf.d/20-posix.ini,
/etc/php/5.6/fpm/conf.d/20-readline.ini,
/etc/php/5.6/fpm/conf.d/20-shmop.ini,
/etc/php/5.6/fpm/conf.d/20-simplexml.ini,
/etc/php/5.6/fpm/conf.d/20-sockets.ini,
/etc/php/5.6/fpm/conf.d/20-sysvmsg.ini,
/etc/php/5.6/fpm/conf.d/20-sysvsem.ini,
/etc/php/5.6/fpm/conf.d/20-sysvshm.ini,
/etc/php/5.6/fpm/conf.d/20-tokenizer.ini,
/etc/php/5.6/fpm/conf.d/20-wddx.ini,
/etc/php/5.6/fpm/conf.d/20-xmlreader.ini,
/etc/php/5.6/fpm/conf.d/20-xmlwriter.ini,
/etc/php/5.6/fpm/conf.d/20-xsl.ini,
/etc/php/5.6/fpm/conf.d/20-zip.ini
我尝试过设置date.timezone
但/etc/php/5.6/fpm/php.ini
也没有效果。
这里发生了什么?
答案1
/etc/php/5.6/fpm/php.ini
应该是正确的文件。在进行/保存更改后,您是否重新启动了 Web 服务器?对于 ubuntu 上的 apache,其为sudo service apach2 restart
。如果您使用的是其他操作系统/Web 服务器,只需在 Google 上搜索重新启动命令即可。
答案2
修改/etc/php/5.6/fpm/php.ini
文件以更改date.timezone
设置后,您应该运行:
sudo systemctl restart php5.6-fpm.service
重新启动 FPM 服务。