PHP CLI configuration file problem Analysis _php instance

Source: Internet
Author: User
Tags php class php cli zts

Introduction

Today, when teaching others to use Protobuf, accidentally found a php cli mode of the strange problem, the cost of a long time to find a solution, here to share.

Problem description

We introduced the PROTOBUF protocol first here, using the allegro/php-protobuf extension installation. These days other colleagues also want to use this, so I will protobuf generate PHP class library file part of a public 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 2015 protoc-php.php

The following two are necessary to generate the PB Protocol implementation class library files 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 using the PSR-4 standard and other colleagues use when found that the error,

PHP warning:file_put_contents (pb_proto_dmp.php): Failed to open stream:permission denied In/data/php_proto/protobufco Mpiler/protobufparser.php on line 309

Colleagues asked me when I said directly, plus sudo on it, and the result of the sudo problem is more serious, the original installed expansion program loading is not successful, after a few checks issued under the following such a problem:

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

Two kinds of user load is not the same profile, the ordinary user loaded is/usr/local/php/lib/php.ini, and the root user loaded is/etc/php.ini This file, I looked at the following two files inconsistent, haha, good fun, hurriedly put first Etc/php.ini Backup,/usr/local/php/lib/php.ini copied to the/etc/php.ini, after the replication, 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
This options nee D 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
This options need to match
 in Unknown on line 0
PHP warning:& nbsp 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/li B/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/phpred Is-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

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/p Hp/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

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/PHPR Edis-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/ 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 confused.

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 be used directly, without sudo (this is my fault, forgot to modify the folder permissions, It also made me discover this bizarre problem.

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

When you see the 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,
......
Name loaded is the same configuration file how does the content after loading not the same?
Search for a long time, know that there are some of the newspaper's fault is related to this, but this where the revision of the old has not been found.

It suddenly occurred to me that the PHP executable file used by root and non-root users was inconsistent

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

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

Try to the original/usr/bin/php backup, copy/usr/local/bin/php over, in the use of php-v found version consistent, also do not complain, and then to execute PHP protoc-php.php-n--PSR Dmp.proto, find all are in, so the problem is resolved.

Entangled for a long time, the result is the version of the problem.

Related Article

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.