User Tools

Site Tools


program_lang:php

PHP / httpd

Get info on php

Here 2 equivalent commands

[root@apache1 dokuwiki]# cat php_version.php
<? php phpinfo(); ?>
[root@apache1 dokuwiki]# php php_version.php

Here we can see php version and detail config like php.ini file, version of each module…

[root@apache1 dokuwiki]# php -i
phpinfo()
PHP Version => 5.6.25

System => Linux apache1 3.10.0-xxx.42.2.el7.x86_64 #1 SMP Tue Aug 31 20:15:00 UTC 2021 x86_64
Build Date => Sep  6 2016 08:19:38
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/opt/rh/rh-php56
Loaded Configuration File => /etc/opt/rh/rh-php56/php.ini
Scan this dir for additional .ini files => /etc/opt/rh/rh-php56/php.d
Additional .ini files parsed => /etc/opt/rh/rh-php56/php.d/20-bz2.ini,
/etc/opt/rh/rh-php56/php.d/20-calendar.ini,
/etc/opt/rh/rh-php56/php.d/20-ctype.ini,
...

List loaded modules

[root@apache1 dokuwiki]# php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
ldap
libxml
mbstring
mhash
openssl
pcntl
pcre
Phar
readline
Reflection
session
SimpleXML
sockets
...

Check PHP consistence, here bad version of mstring module, and time zone not set

[root@apache1 dokuwiki]# php -i | grep -i "Loaded Configuration File"
PHP Warning:  PHP Startup: mbstring: Unable to initialize module
Module compiled with module API=20100525
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0
Loaded Configuration File => /etc/opt/rh/rh-php56/php.ini
PHP Warning:  Unknown: 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 Unknown on line 0

In my case modules are located into /opt/rh/rh-php56/root/usr/lib64/php/modules (php -i)

program_lang/php.txt · Last modified: 2021/10/12 10:06 by manu