How to install the pthreads PHP extension on Debian 9 - php

Surprisingly, I can't find an answer anywhere. I need help to install the pthreads PHP extension on Debian 9 with PHP 7.3 installed.
If I write php -v, I get the following:
PHP 7.3.6-1+0~20190531112735.39+stretch~1.gbp6131b7 (cli) (built: May 31 2019 11:27:35) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.6-1+0~20190531112735.39+stretch~1.gbp6131b7, Copyright (c) 1999-2018, by Zend Technologies
I tried to download the .tgz file form pecl.php.net, extract it, put it in /etc/php/7.3/fpm/ext (I created the ext directory) and define the extension_dir as that directory in php.ini.
Then I wrote in the php.ini file extension=/etc/php/7.3/fpm/ext/pthreads-3.1.6 and I rebooted my server.
If I write php -m, I still not see the pthreads extension.

Related

Cannot load the ionCube PHP Loader in PHP 8.1 (Apple M1 arm64)

I am on the Apple M1 arm64 chip arm64.
I am trying to install the ioncube for PHP 7.4
On the ioncube website i download the package above:
Failed loading /opt/homebrew/opt/php#8.0/lib/httpd/modules/ioncube_loader_dar_7.4.so:
dlopen(/opt/homebrew/opt/php#8.0/lib/httpd/modules/ioncube_loader_dar_7.4.so,
0x0009): tried: '/opt/homebrew/opt/php#8.0/lib/httpd/modules/ioncube_loader_dar_7.4.so'
(code signature in <271472A6-19B1-339D-AE94-FD446AED8DB2>
'/opt/homebrew/Cellar/php#8.0/8.0.27/lib/httpd/modules/ioncube_loader_dar_7.4.so'
not valid for use in process: library load disallowed by system policy),
'/opt/homebrew/Cellar/php#8.0/8.0.27/lib/httpd/modules/ioncube_loader_dar_7.4.so'
(code signature in <271472A6-19B1-339D-AE94-FD446AED8DB2>
'/opt/homebrew/Cellar/php#8.0/8.0.27/lib/httpd/modules/ioncube_loader_dar_7.4.so'
not valid for use in process: library load disallowed by system policy
Afterwards i tried macOS (64 bits) version
Cannot load the ionCube PHP Loader - it was built with configuration API320190902,NTS, whereas running engine is API420200930,NTS
PHP 8.0.27 (cli) (built: Jan 12 2023 02:35:14) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.27, Copyright (c) Zend Technologies
with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans
with Zend OPcache v8.0.27, Copyright (c), by Zend Technologies
With PHP 7.4 i don't have any problems.
How i can solve the problem in PHP 8.1?

Can't install Xdebug on PHP

Trying to install Xdebug so I can debug PHP with VS Code, followed the instructions of the page step by step, reference Xdebug wizard.
Download php_xdebug-3.1.6-8.1-vs16-x86_64.dll
Move the downloaded file to \xampp\php\ext, and rename it to php_xdebug.dll
Update C:\xampp\php\php.ini and add the line:
zend_extension = xdebug
Restart the Apache Webserver
To verify correct installation run cmd and type php -v, output should list Xdebug installed:
PHP 7.4.10 (cli) (built: Aug 18 2020 09:37:14) ( NTS DEBUG )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.10-dev, Copyright (c), by Zend Technologies
with Xdebug v3.0.0-dev, Copyright (c) 2002-2020, by Derick Rethan
Installation is trivial, I don't have cloned .ini files, I'm getting the right dll from the page, I'm restarting Apache, my renameing of the dll is right. I don't know what is going on, my output from cmd is:
C:\Users\User>php -v
PHP 8.1.13 (cli) (built: Nov 22 2022 15:49:14) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.13, Copyright (c) Zend Technologies
My PHP version is: 8.1.12
Also tried changing the ini file to
;zend_extension="c:\xampp\php\ext\php_xdebug.dll"
which is the actual path where the dll is located. Also my PHP is TS, so is the file it's downloading from the wizard. Any hints?
As #aynber said in a comment, semicolon is used for indicating comments and therefore the line
zend_extension="c:\xampp\php\ext\php_xdebug.dll"
is not processed

Change CLI PHP version on Mac

I using Mac BigSur lastest update.
I have install Bitnami MAPP with PHP version 8.0.8.
But in CLI still PHP 7.3.24
I try create PATH to Bitnami PHP8.0.8 but have warning like below
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.24-(to be removed in future macOS) (cli) (built: Dec 21 2020 21:33:25) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies
How to switch PHP CLI to PHP8.0.8 of Bitnami?
Bitnami engineer here!
The output you are seeing is produced by the PHP binary that comes preinstalled in macOS. When you install Bitnami MAMP, a standalone, updated version of PHP will also be installed in your system. In order to use it instead of the default one, you have two options:
Use the full path to the binary (installdir/php/bin/php)
$ /Applications/mampstack-8.0.9-0/php/bin/php --version
PHP 8.0.9 (cli) (built: Jul 30 2021 07:59:45) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.9, Copyright (c) Zend Technologies
with Zend OPcache v8.0.9, Copyright (c), by Zend Technologies
Add the directory containing the PHP binary to your path
$ export PATH=/Applications/mampstack-8.0.9-0/php/bin:$PATH
$php --version
PHP 8.0.9 (cli) (built: Jul 30 2021 07:59:45) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.9, Copyright (c) Zend Technologies
with Zend OPcache v8.0.9, Copyright (c), by Zend Technologies
For the examples above, /Applications/mampstack-8.0.9-0 was the installation directory (installdir) of the stack.

php versions are shown differently in WHM and server

In server, it shows 7.0 php like below from either cPanel
or cat /etc/apache2/conf.d/php.version in server
However in php --version, it shows php5.6.
How can I upgrade my php to 7.0? Thanks.
If you change PHP version from cpanel account it will be applied and your website will use the new version.
php -v command shows the default version of PHP for your system but if you want to check PHP version for your cpanel account only you have to modify your ~/.bashrc file:
alias php="/opt/cpanel/ea-php70/root/usr/bin/php"
and then:
source ~/.bashrc
Now you'll find the output some thing like:
php -v
PHP 7.0.33 (cli) (built: xxxxxx) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies

Set default version of Php in CentOS 7

I have two versions of PHP in opt/remi folder php56 and php72
but when I php -v on cmd it shows:
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
How to set default version to PHP 7.2?
I have two versions of PHP in opt/remi folder php56 and php72
how to set default version to PHP 7.2
SCL are designed for parallel installation so don't alter default version in base system
Once the collection is enabled, the version will be used
$ scl enable php72 bash
$ php -v
PHP 7.2.8 (cli) (built: Jul 17 2018 05:35:43) ( NTS )
If you want 7.2 to be the default version (base system) you should install it, according to Wizard instructions for "Default / single version" (and keep 5.6 as secondary version)
Change php cli version in Centos 7
First, find your php7, run phpinfo() and get path or you can do with other ways. for me, it is:
/usr/local/lsws/lsphp73/
then:
cd ~
. ~/.bash_profile
And:
alias php='/usr/local/lsws/lsphp73/bin/php'
Now:
php -v
PHP 7.3.13 (cli) (built: Dec 20 2019 16:02:35) ( NTS )
Create a file "/etc/profile.d/php.sh". Use pathmunge to add the path to your php bin you want as default on line one and save the file.
Example:
pathmunge /opt/remi/php73/root/bin
Reload your profile afterwards by logging in again.
Now if you do a which php and php -v you should see the following output in my case
[root#host etc]# which php
/opt/remi/php73/root/bin/php
[root#host etc]# php -v
PHP 7.3.4 (cli) (built: Apr 2 2019 13:48:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.3.4, Copyright (c) 2002-2019, by ionCube Ltd.
This is the preferred way to accomplish this task using tools that are already supplied on a minimal install. This also allows scripts and commands to hit the correct php binaries when accomplishing other tasks. Commands like, pear, pecl, phar, php-config. You want your experience to be global when setting the default, otherwise you might wind up still getting version 5.6's tools when trying to install an extension or complete another task.
module enable php74
for your understanding:
cat /opt/remi/php74/enable
export PATH=/opt/remi/php74/root/usr/bin:/opt/remi/php74/root/usr/sbin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/opt/remi/php74/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export MANPATH=/opt/remi/php74/root/usr/share/man:${MANPATH}

Categories