I am using php 7.0 in Ubuntu 18.04 LTS.
I have to implement multi-threading in php with help of pthread.
Several method I tried but every time getting
configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled
ERROR: `/tmp/pear/temp/pthreads/configure --with-php-config=/usr/bin/php-config' failed
Even I tried to install php from scratch but could not success.
I was follow following website steps :
https://www.rapidspike.com/blog/php7-pthreads/
Please help.
According to your comment:
php -v output is follow : PHP 7.0.31-1+ubuntu18.04.1+deb.sury.org+1
(cli) (built: Jul 25 2018 10:01:10) ( NTS ) Copyright (c) 1997-2017
The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend
Technologies with Zend OPcache v7.0.31-1+ubuntu18.04.1+deb.sury.org+1,
Copyright (c) 1999-2017, by Zend Technologies with Xdebug v2.6.0,
Copyright (c) 2002-2018, by Derick Rethans
You are trying to install a pecl package against the invalid version of PHP which is in your case ( NTS ) instead of ( ZTS ).
To get rid of this you will need one of this possible actions:-
1- Install pecl package for a specific PHP version.
pecl -d php_suffix=X.X-zts install pthreads
2- Update the default version for your environment.
sudo update-alternatives --set php /usr/bin/phpX.X-zts
Note & Warning: this means that all of your php terminal applications will be running under the ZTS version which may cause some unexpected behaviors.
However you can toggle your PHP versions back after installation.
3 - Compile phtread from source and define the target PHP version (complicated but preferred).
$ git clone https://github.com/krakjoe/pthreads.git
$ cd pthreads/
$ phpize
$ ./configure --with-php-config=/path/to/php-zts/bin/php-config
$ make
$ make install
You will may need to update alternatives also for phpize
update-alternatives --set phpize /usr/bin/phpize-zts
Note: All of PHP versions that had been mentioned in this answer may be different from setup to setup, So you may need to check your PHP version name&path using locate bin/php
Related
I'm trying to install xdebug.
I've already seen some issues about it (like this one : Installing xdebug with PHP 5.5 ) but it seems outdated and not corresponding to my issue).
When I try
sudo pecl install xdebug
I'm getting the following error
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading xdebug-2.8.0.tgz ...
Starting to download xdebug-2.8.0.tgz (238,122 bytes)
.................................................done: 238,122 bytes
69 source files, building
running: phpize
sh: 1: phpize: not found
ERROR: `phpize' failed
It seems that means phpize isn't installed in my php version
php -v
PHP 7.2.24-0ubuntu0.19.04.1 (cli) (built: Oct 24 2019 11:49:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.19.04.1, Copyright (c) 1999-2018, by Zend Technologies
So, some topics seems to tell me to change my php version to download a version with phpsize included. But I was more looking for a way to add phpsize to my current php version but I don't know how to do that.
Thanks for your assistance
If Ubuntu first you need install php dev version:
sudo apt install php7.x-dev
And then:
sudo pecl install xdebug
I had some problems with xdebug version too.
I had to install an specific version for php7.1 using PECL,
I don't really know if your question is already solved but let me share you this webpage, it's the compatibility graph to know wich version works with an specific php versions:
https://xdebug.org/docs/compat
As far as I know if you want to install the latest xdebug version you can use the repo, but if you need an old version you'll be forced to install it using PECL.
Hope you find this answer usefull!
Hello I having trouble to to install "jenssegers/mongodb": "^3.2" on my local environment.
i have this error:
I have added to my /etc/php.ini full path to extentions="/usr/lib/php/extensions/no-debug-non-zts-20160303/mongodb.so"
restart the php and apache
I have try to find mongodb.ini, fail on that.
I try all the tutorial is google... still no luck
Can any one help me please?
PHP 7.1.23 (cli) (built: Feb 22 2019 22:08:13) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
It seems that you forgot to install MongoDB PHP Driver itself.
To do that just install it with pecl:
sudo pecl install mongodb-1.5.3
1.5.3 is the last stable version, so I'd recommend to use it rather than the most recent 1.6.0alpha.
Then, don't forget to add it to your php.ini (run php --ini to see where it's located):
extension=mongodb.so
To test that it works just run:
php -m | grep mongo
If you see mongodb in output, then it works.
hi i install homebrew install some brew things and now i need install Xdebug but when i write to terminal on mac php --version there is only version of php not version php with xdebug only version of php
$ php --version
PHP 7.2.8 (cli) (built: Aug 28 2018 16:32:29) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
help me i doo all things what i should but it not work correctly help thx
With the migration to Homebrew-core the php formula has stopped taking over the role of PECL. Installing xdebug can (and should) be done through PECL (https://pecl.php.net/package/xdebug).
pecl update-channels
pecl list-all
pecl install xdebug
or upgrade it
pecl upgrade xdebug
After that you'd need to update your php.ini with a line to specify xdebug's location, as suggested on xdebug.org:
zend_extension="/usr/local/php/modules/xdebug.so"
Additionally, you may need to put in there some settings for xdebug, for example:
xdebug.collect_vars=1
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_port=9005
Source: http://www.artemdwo.com/install-php72-and-xdebug-on-mac-os-x
Why I am getting 2 different versions of php ?
When I am checking via a php file:
<?php
echo 'Current PHP version: ' . phpversion();
output:
Current PHP version: 7.0.18-1+deb.sury.org~xenial+1
When I am checking via a terminal command:
root#dev-Inspiron-N5110:~# php -v
PHP 7.1.4-1+deb.sury.org~xenial+1 (cli) (built: Apr 11 2017 22:12:32)
( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.4-1+deb.sury.org~xenial+1, Copyright (c) 1999-
2017, by Zend Technologies
php -v giving me PHP 7.1.4-1+deb.sury.org~xenial+1 and phpversion() giving me 7.0.18-1+deb.sury.org~xenial+1.
That is because you have two different versions installed for PHP. The PHP cli is picking up the latest one whereas Apache has been set up with php 7.0.
What you can do is remove both the PHP version from your system and then do a fresh install again:
sudo apt-get install ppa-purge
sudo ppa-purge ppa:ondrej/php-7.0
sudo apt-get purge php7.*
and then install latest PHP 7 from the official Ubuntu Repository like so:
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
as you are using Ubuntu 16 the new PHP version will be >=7
I cannot install Composer on Ubuntu 14.04 with:
sudo curl -sS https://getcomposer.org/installer | php
I got error:
#!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The json extension is missing.
Install it or recompile php without --disable-json
The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl
Current PHP version:
PHP 5.5.3 (cli) (built: Feb 9 2015 12:47:41)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies