This article mainly introduces the analysis of phpcli configuration file problems. For more information, see
This article mainly introduces the Problem Analysis of the php cli configuration file. For more information, see
Introduction
Today, when I was teaching others to use protobuf, I accidentally found a strange problem in the php cli mode. I spent a long time finding a solution. I 'd like to share it here.
Problem description
We first introduced the protobuf protocol, which was installed using the extension allegro/php-protobuf. This is also used by other colleagues in the past few days, so I put the part of the php class library file generated by protobuf to a public location/data/php_proto/folder, which contains this content,
Drwsrwxr-x 2 yanruitao users 4096 October 14 17:05 Dmp
-Rwxrwxr-x 1 yanruitao users 472 17:59 dmp. proto
Drwsrwxr-x 2 yanruitao users 4096 17:54 ProtobufCompiler
-Rwxrwxr-x 1 yanruitao users 2969 March 9 protoc-php.php
The following two are mandatory and will be used to generate pb protocol implementation class library files. The first two are a simple example, which is also very simple to use, as shown below.
Php protoc-php.php-n -- his dmp. proto //-n is using namespace, -- his is using psr-4 standards and other colleagues' use will report an error,
PHP Warning: file_put_contents (pb_proto_dmp.php): failed to open stream: Permission denied in/data/php_proto/ProtobufCompiler/ProtobufParser. php on line 309
When my colleague asked me, I directly said that we can add sudo, and The sudo problem is more serious. The originally installed extension cannot be loaded, after some troubleshooting, the following problem occurs:
$ Yanruitao: php-I | grep 'php. ini'
$ Yanruitao: sudo php-I | grep 'php. ini'
The two types of user load are not the same configuration file. Common users load/usr/local/php/lib/php. ini, while the root user loads/etc/php. ini file. I have read the inconsistency between the two files. Haha, I'm so happy. Hurry up and put/etc/php first. ini backup,/usr/local/php/lib/php. copy ini to/etc/php. ini. After I copied it, I was shocked when I used it again and reported a lot of errors:
PHP Warning: PHP Startup: unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/web_stub_cntl.so'-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/web_stub_cntl.so: undefined symbol: zend_new_interned_string in Unknown on line 0
Warning: PHP Startup: unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/web_stub_cntl.so'-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/web_stub_cntl.so: undefined symbol: zend_new_interned_string in Unknown on line 0
PHP Warning: PHP Startup: test: Unable to initialize module
Module compiled with module API = 20100525
PHP compiled with module API = 20090626
These options need to match
In Unknown on line 0
Warning: PHP Startup: test: Unable to initialize module
Module compiled with module API = 20100525
PHP compiled with module API = 20090626
These options need to match
In Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/protobuf. so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/protobuf. so: undefined symbol: zend_new_interned_string in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/protobuf. so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/protobuf. so: undefined symbol: zend_new_interned_string in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/imagick. so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/imagick. so: undefined symbol: zend_new_interned_string in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/imagick. so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/imagick. so: undefined symbol: zend_new_interned_string in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/data/boss/phpredis-develop/modules/redis. so '-/data/boss/phpredis-develop/modules/redis. so: undefined symbol: zend_new_interned_string in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/data/boss/phpredis-develop/modules/redis. so '-/data/boss/phpredis-develop/modules/redis. so: undefined symbol: zend_new_interned_string in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/curl. so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/curl. so: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/curl. so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/curl. so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/fileinfo. so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/fileinfo. so: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/fileinfo. so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/fileinfo. so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/gd. so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/gd. so: cannot open shared object file: No such file or directory in Unknown on line 0