PHP CLI configuration file problem analysis, _php tutorial

Source: Internet
Author: User

PHP CLI configuration file Problem analysis,


Introduction

Today in the teaching of others to use PROTOBUF, inadvertently found a PHP cli mode of the strange problem, the cost of long time find a solution, here to share.

Problem description

Our side first introduced the PROTOBUF protocol, which was installed using the allegro/php-protobuf extension. These days other colleagues also want to use this, so I will protobuf generate PHP class library file parts into a common location/data/php_proto/folder, there are these contents,

Drwsrwxr-x 2 Yanruitao users 4096 October 17:05 DMP
-rwxrwxr-x 1 Yanruitao users 472 October 17:59 Dmp.proto
Drwsrwxr-x 2 Yanruitao users 4096 October 17:54 Protobufcompiler
-rwxrwxr-x 1 Yanruitao users 2969 March 9 protoc-php.php

The next two is necessary, the generation of PB protocol implementation of the class library file will be used, the first two is a simple example, the use is very simple, like the following.

PHP protoc-php.php-n--PSR Dmp.proto//-n is the use of namespaces,--PSR is the use of psr-4 standards and other colleagues used to find the 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

My colleague asked me when I directly said, plus sudo on it, and the result plus sudo problem is more serious, originally loaded extension program loading is not successful, after a few troubleshooting sent under a problem such as:

$yanruitao: Php-i | grep ' php.ini '
$yanruitao: sudo php-i | grep ' php.ini '

Two kinds of user load is not the same profile, the normal user load is/usr/local/php/lib/php.ini, and the root user is loaded/etc/php.ini This file, I looked at the next two files content inconsistent, haha, very happy, hurriedly put the first/ Etc/php.ini Backup,/usr/local/php/lib/php.ini Copy to/etc/php.ini, after copying, I used the time to scare me, 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/e Xtensions/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-deve Lop/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 St artup: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/loc Al/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

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
PHP warning:php startup:unable to load dynamic library '/usr/local/php/lib/php/exte Nsions/no-debug-non-zts-20100525/json.so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/json.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/ Json.so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/json.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/phar.so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/ Phar.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/ Phar.so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/phar.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 '/data/boss/phpredis-de Velop/modules/redis.so '-/data/boss/phpredis-develop/modules/redis.so:undefined symbol:zend_new_interned_string In Unknown to 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/ Zip.so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/zip.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/ Zip.so '-/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/zip.so:cannot open shared object File:no such File or directory in Unknown on line 0
protoc-php.php requires PROTOBUF extension installed to run

It makes me feel a sense of the mind.

Time passed long, did not find any breakthrough, but found a backup solution to this problem, modify the/data/php_proto/folder permissions of 0775, other ordinary users can directly use, without adding sudo (this is my fault, forget to modify the folder permissions, It also made me find this weird problem.

Chmod-r 0775/data/php_proto
Read the report of these errors, most of them are the expansion of the problem, some of the expansion is not successful, some extensions do not exist, I wonder why ordinary users can, root users can not.

When you see root user php-i, the location of the configuration file is inconsistent with the non-root user:

Non-root

Scan this dir for additional. ini files = (none)
Additional. ini files parsed = (none)

Root
Scan this dir for additional. ini files =/etc/php.d
Additional. ini files parsed =/etc/php.d/curl.ini,
......
The name loaded is the same as the configuration file how to load after the content is not the same?
Search for a long time, know that the wrong part of the report is related to this, but this change in the search of the old and did not search.

It suddenly occurred to me that the root user and the non-root user php executable file is inconsistent

root =/usr/bin/php
Non-root =/usr/local/bin/php

Try to use the two files php-v, the results of my jump, root user version is 5.3.3, non-root user is 5.4.6, hehe, I will hehe, who deployed the environment ~, deceptive AH.

Try to back up the original/usr/bin/php, copy/usr/local/bin/php come over, in the use of php-v found version consistent, also do not error, again to execute PHP protoc-php.php-n--PSR Dmp.proto, found all was well, to this point resolved.

Tangled up for a long while, the result is version of the problem.

http://www.bkjia.com/PHPjc/1061523.html www.bkjia.com true http://www.bkjia.com/PHPjc/1061523.html techarticle PHP CLI configuration file Problem analysis, Introduction today in the teaching of others to use PROTOBUF, inadvertently found a PHP cli mode of the strange problem, the cost of long time to find a solution ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.