当前位置:  开发笔记 > 编程语言 > 正文

PHP 7.0.1无法加载ini文件

如何解决《PHP7.0.1无法加载ini文件》经验,为你挑选了1个好方法。

文件存在于路径中,但php无法加载ini文件.我尝试 - 更改chmod,chown,更改配置路径.没有结果.

# /opt/php7/bin/php -i
phpinfo()
PHP Version => 7.0.1

System => Linux portal-app 3.8.13-68.1.3.el7uek.x86_64 #2 SMP Wed Apr 22 11:51:54 PDT 2015 x86_64
Build Date => Dec 18 2015 10:01:55
Configure Command =>  './configure'  '--prefix=/opt/php7' '--exec- prefix=/opt/php7' '--enable-fpm' '--with-fpm-user=user' '--with-fpm-group=nginx' '--disable-cgi' '--disable-short-tags' '--with-openssl' '--with-zlib' '--with-curl' '--with-snmp' '--with-xmlrpc' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-zlib-dir' '--enable-gd-native-ttf' '--with-freetype-dir' '--with-gettext' '--enable-exif' '--enable-intl' '--enable-ftp' '--enable-zip' '--with-mcrypt' '--with-imap=/opt/distrib/php7/ext/imap-2007f' '--with-imap-ssl' '--with-ldap' '--with-ldap-sasl' '--enable-mbstring' '--enable-soap' '--enable-pcntl' '--enable-sockets' '--enable-bcmath' '--enable-mysqlnd' '--with-pdo-mysql' '--with-pdo-pgsql' '--with-pgsql' '--with-libdir=lib64' '--with-fpm-systemd'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /opt/php7/lib
Loaded Configuration File => (none)
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20151012
PHP Extension => 20151012
Zend Extension => 320151012

# ls -la /opt/php7/lib
drwxr-xr-x 15 root root  4096 ???  8 09:24 php
-rwxr-xr-x  1 php  nginx  760 ??? 18 10:12 php.ini

Vovan4elli.. 5

strace帮我找到了问题.

# echo "" | strace /opt/php7/bin/php  2>&1 | grep php.ini
open("/etc/php7/php.ini/php-cli.ini", O_RDONLY) = -1 ENOTDIR (Not a directory)
open("/opt/php7/bin/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/php7/php.ini/php.ini", O_RDONLY) = -1 ENOTDIR (Not a directory)

我不明白为什么,但PHP正在寻找错误的文件夹.似乎改变with-config-file-path没有make clean导致问题.

我加入--with-config-file-path=/opt/php7/lib./configure和执行make clean && make && make install.

它解决了这个问题.



1> Vovan4elli..:

strace帮我找到了问题.

# echo "" | strace /opt/php7/bin/php  2>&1 | grep php.ini
open("/etc/php7/php.ini/php-cli.ini", O_RDONLY) = -1 ENOTDIR (Not a directory)
open("/opt/php7/bin/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/php7/php.ini/php.ini", O_RDONLY) = -1 ENOTDIR (Not a directory)

我不明白为什么,但PHP正在寻找错误的文件夹.似乎改变with-config-file-path没有make clean导致问题.

我加入--with-config-file-path=/opt/php7/lib./configure和执行make clean && make && make install.

它解决了这个问题.

推荐阅读
wangtao
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有