Apache not Reading php.ini Changes Configuring Fedora 30 During New Zoneminder Install

| 1 Comment

I wanted to setup some quick testing of Zoneminder on different platforms last night and started the basic configurations. Installed Fedora 30 , installed RpmFusion repository, installed mysql community database mariadb, Apache installed, install Zoneminder rpms using “dnf” etc..

Went through the initial steps with Zoneminder configurations opened up firewall ports then navigated to the initial web page and got the message:

ZoneMinder is not installed properly: php’s date.timezone is not set to a valid timezone”

Should be simple go into “/etc/php.ini” set date.timezone restart Apache/HTTPD and get past that message then get in and do the initial configurations within Zoneminder but that’s not what happened.

In “/etc/php.ini I set date.timezone to America/Los_Angeles restarted Apache with systemctl and no changes. Checked for typos and invisible characters in “/etc/php.ini” restarted and nothing changed again. I started checking permissions on web files, started looking through “/etc/http/conf.d/php.conf” check Zonemindr config files everything looks solid but I still get the “ZoneMinder is not installed properly: php’s date.timezone is not set to a valid timezone” message.

This is a minimal install and I’m very sure I only have one version of php and Apache. To confirm I run:

#php -i | grep timezone
Default timezone => America/Los_Angeles
date.timezone => America/Los_Angeles => America/Los_Angeles

This shows I have set my timezone parameters properly yet I still get the message “ZoneMinder is not installed properly: php’s date.timezone is not set to a valid timezone”

# php -i | grep -i config
Configuration File (php.ini) Path => /etc
Loaded
Configuration File => /etc/php.ini
Configuration
Openssl default
config => /etc/pki/tls/openssl.cnf


Once again looks good and proves I’m editing the only and correct php.ini file but this isn’t translating to Zoneminder I looked for overriding parameters not finding any.

I found many workarounds in forums like providing the date.timezone value in “/etc/http/conf.d/php.conf” or going into “/usr/share/zoneminder/www/index.php” and commenting out the code checking date.timezone for the Zoneminder application. I don’t want edits and hacks all over in non-default files because when updating or changing things these things may cause issues.

Finally I created a phpinfo web page navigate to it and date.timezone value is blank!! Doing “php -i” shows properly still!

#php -i | grep timezone
Default timezone => America/Los_Angeles
date.timezone => America/Los_Angeles => America/Los_Angeles

Ok so obviously php.ini isn’t passing the date.timezone parameter to Apache for some reason even though the phpinfo web page shows it’s using the “/etc/php.ini” configuration file for php!

I checked the current Zoneminder system and they are setup with Apache and PHP identically except the OS versions Fedora 28 versus Fedora 30 so I started searching for difference in the versions and found what I needed in the Fedora forums. FastCGI is now a required dependency for Apache/httpd via the “php-fpm” service.

#systemctl status php-fpm

php-fpm.service – The PHP FastCGI Process Manager

I noticedphp-fpm has not been restarted since I made my changes in “/etc/php.ini” so now I decide to restart “php-fpm” and the “ZoneMinder is not installed properly: php’s date.timezone is not set to a valid timezone” message is gone so now I can actually configure Zoneminder with my cameras!

Basically this is what’s needed to make sure your changes you make in /etc/php.ini are passed on to Apache in Fedora 30 and possibly other versions starting at Fedora 27 though I didn’t have this issue with Fedora 28 or I didn’t notice it for some reason:

#vi /etc/php-fpm.conf

Make this change:

date.timezone = America/Los_Angeles

# systemctl restart httpd

# systemctl restart php-fpm

Verify by creating a pphpinfo file and navigating to it

Contents of phpinfo.php:

<?php phpinfo(); ?>

Example:

#cat /var/www/html/phpinfo.php
<?php phpinfo(); ?>

#



Fedora forum posts that pointed me in the right direction:

https://forums.fedoraforum.org/showthread.php?317215-Apache-PHP-Configuration which referenced:

https://blog.remirepo.net/post/2017/11/17/Fedora-27-changes-in-http-and-php

One Comment

Leave a Reply

Required fields are marked *.


%d