PHP 5.6 ZTS and PHP 7 ZTS MongoDB Driver issue

时间:2018-01-11 08:37:56

标签: php mongodb pthreads php-5.6 zts

I had a major problem with choice of PHP and MongoDB versions.

I have a project developed in PHP5.6 with PHP 5 MongoDB Driver and I am willing to use PHP with ZTS and pThreads for parallel execution. Unfortunately when I compile PHP with ZTS and pthreads compiler gives me error while setting up PHP

/usr/src/php-5.6.12/meta_ccld -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/pthreads/ -I/usr/src/php-5.6.12/ext/pthreads/ -DPHP_ATOM_INC -I/usr/src/php-5.6.12/include -I/usr/src/php-5.6.12/main -I/usr/src/php-5.6.12 -I/usr/src/php-5.6.12/ext/date/lib -I/usr/src/php-5.6.12/ext/ereg/regex -I/usr/include/libxml2 -I/usr/src/php-5.6.12/ext/mbstring/oniguruma -I/usr/src/php-5.6.12/ext/mbstring/libmbfl -I/usr/src/php-5.6.12/ext/mbstring/libmbfl/mbfl -I/usr/src/php-5.6.12/ext/sqlite3/libsqlite -I/usr/src/php-5.6.12/ext/pthreads -I/usr/src/php-5.6.12/ext/zip/lib -I/usr/src/php-5.6.12/TSRM -I/usr/src/php-5.6.12/Zend -D_REENTRANT -I/usr/include -g -fvisibility=hidden -pthread - O0 -Wall -DZTS -c /usr/src/php-5.6.12/ext/pthreads/php_pthreads.c  -fPIC -DPIC -o ext/pthreads/.libs/php_pthreads.o

In file included from /usr/src/php-5.6.12/ext/pthreads/php_pthreads.c:22:0:

ext/pthreads/src/pthreads.h:72:35: fatal error:
Zend/zend_inheritance.h: No such file or directory #include
^
compilation terminated.
make: *** [ext/pthreads/php_pthreads.lo] Error 1

Now, one may thing why I am sticking to PHP5, Its clearly becuase of MongoDB driver of php5. PHP7 with ZTS works perfectly but again I canot connect MongoDB because php7 have different mongoDB driver.

Please guide me whether updating code to PHP7 Mongo is just a solution left with me ? or is there any workaround ?

Thanks in Advance.

2 个答案:

答案 0 :(得分:0)

我通过使用CentOS 6.5配置PHP ZTS 5.5.8来修复它

我的问题是我正在使用php 5.x安装pthreads v3但不幸的是它不受支持。我也试过pthreads v2和ubuntu,但不知何故它不会工作所以我改变了destro并且它现在完美地工作。

希望它会对某人有所帮助。

答案 1 :(得分:0)

在文件夹pthreads中运行:

git checkout PHP5

我用ZTS安装了PHP5:

mkdir /usr/local/src/
wget http://uk1.php.net/get/php-5.6.12.tar.gz/from/this/mirror -O php.tar.gz
tar xzvf php.tar.gz
cd php-5.6.12/ext
git clone https://github.com/krakjoe/pthreads.git
cd pthreads
git checkout PHP5