PHP7.2 ZTS + PThreads on Ubuntu 16.04; Install additional packages - php

I have a test server running Ubuntu 16.04. I managed to compile PHP 7.2.2 with ZTS from source and installed PThreads on it.
Now, how do I proceed with further setting up PHP without damaging my installation? If I try to install, let's say PHP Curl or Apache's PHP 7.2 module, Ubuntu wants me to install php7.2-common, etc. which would overwrite my current installation.
Is there a safe way to install additional PHP modules and hook up PHP with Apache2?
Thank you in advance!

Related

Upgrading from php7.0.33 to php7.3 on Debian 10 (Buster)

I have a web server running on virtual machine Debian 10 (Buster)
I need to upgrade the PHP 7.0.33 to PHP 7.1 or higher, and as you know, debian buster already has PHP 7.3 ready to be installed.
the problem is when i try to sudo apt-get install php7.3-cli or any other php extension it asks me to remove local custome packages which are essential for the web server becase they depends on the old php version.
I tried to do sudo apt-mark hold <custom_package>, but it is still asking me to remove them and preventing me from upgrading/installing the new php version.
How to fix this issue?
Am i doing something wrong?
the reason for upgrading the php is that the upgraded version of web server content requires php version to be 7.1 or higher, i even tried to neglect this platform check, the web server worked but with issues which make the server unfuntional.
Sorry, i'm new to this and just trying to resolve the problem.
Regards,

Install MongoDB PHP Extension for PHP 8.1 (Debian)

sorry if there is a duplicate question for this but I'm trying to set this up for hours now and it just doesn't work.
I have a Debian 11 server with "KeyHelp" installed on it (little brother of plesk). It comes with PHP 7.4 but provides a simple Dashboard where you can install other PHP versions. I installed PHP 8.1 and tried to install the mongodb extension via PECL.
After "pecl install mongodb" I added "extension=mongodb.so" and after that didn't show up the extension on the phpinfo page, I double checked if the extension is really in the extension folder of php, where it was.
Turns out that I installed the extension for PHP 7.4 and not for PHP 8.1. Finally I tried to force PECL to install it for PHP 8.1 but it says "phpize8.1 command not found". I found no way to install phpize8.1, can somebody help me out with that?
Thanks in advance!
I am using Ubuntu 20.04
I have PHP 8.1 version. You have to install modules of PHP
sudo apt install php8.1-mongodb
List the modules
php -m
It's not exactly Debian. I hope it helps you.
If you run command:
sudo apt install php-dev
System will install automatically the correct version of php{x}-dev for your distribution, and all it's dependencies, included PECL.
another way is try to run:
/usr/bin/phpize
If this command works, you need to add phpize to your PATH:
PATH=$PATH\:/usr/bin; export PATH
In this way phpize will work in future.

Linux add PHP 7.4 to Webmin/Virtualmin

My current setup of Webmin/Virtualmin has PHP 5.6 and 7.2. More and more composer packages have a requirement of PHP 7.4. I don't want to have 7.4 as the default PHP, I have sites on the server that need 5.6 (I know, not great but it's the way it is), so I'm trying to get 7.4 installed in the same structure as 7.2, in the /opt/rh folder.
The version of Linux is "CentOS Linux release 7.8.2003 (Core)"
I've tried to do this about 5 times and failed each time, there is just no information (that I can find) out there to say how to do this. Any help would be massively appreciated.
If you need to keep default version of PHP, make sure to install PHP 7.4 from [remi-safe] repos.
Install Remi Release repo and clear cache:
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm && yum clean all
Install PHP 7.4 packages:
yum -y install php74-php-{cli,pdo,fpm,zip,gd,xml,mysqlnd}
It's clearly described in our documentation page on how to install different versions of PHP for Virtualmin.
You can have couple version of php running in the same time.
Check this
Multiple PHP Version on Centos

How to download PHP -thread safe now that Homebrew no longer support --with-thread-safety?

I need to use PHP pthreads on Mac OS High Sierra, but Homebrew is no longer supporting downloads of PHP --with-thread-safety.
How do I get and install a thread safe version of PHP for Mac OS, Php v7.1.16 without homebrew?
If it is going to have to be some sort of manual install - does anyone have step by step directions for the mac or know where I can get instructions?
I have been looking on the internet for instructions for 5 hours now. I'm tired and can't believe that no one has any posted info on this.
I was able to get PHP 7.2.5 installed on Mac OS HighSierra with ZTS/Thread safety by using phpbrew.
Install Steps I took:
Downloaded phpbrew from http://phpbrew.github.io/phpbrew/ and installed with their directions. Please note at the end of the installation, they give you further instructions for setting up your ~/.bashrc to load phpbrew, look for them at the terminal.
Once you have phpbrew running you are ready to install php with zts by using the command below (of course you can install all of the extensions that you like by checking the installation for extension instruction)
phpbrew install php-7.2.5 +openssl='/usr/local/opt/openssl/' -- --enable-maintainer-zts --with-curl=/usr/local/
It is important to have openssl and curl already installed before installing php and you must point to their location on your computer at the install line as I have done above. You can add all the extensions you need, but you must have the openssl and curl because I had a ton of problems with installation without them. But you could try omitting.
For those of you who are using PHP ZTS so that you can go on to install pthreads --ONLY PHP 7.2 and above works with Krakjoes pthread-master which you can download and follow the installation at https://github.com/krakjoe/pthreads

PHP is not loaded as a module of Apache

I'm currently developing a web page with PHP, and I had to install Pthread extension, I made it in the server (Ubuntu 14) so, before I had all working well, the problem came when I installed the extension, to install this extension I had to compile the php to make the needed configurations of PHP. Now, when I open a simple page, apache shows me the php code, it means that php is not interpreting or is not loaded in the modules of apache.
I went to /etc/apache2/mods-enabled but there's nothing of PHP, but in the linux terminal PHP is working well (so, it's installed). then I made:
sudo a2enmod php5
And I get this response:
ERROR: Module php5 does not exist!
then , I made:
a2query -m php5
but I get:
No module matches php5
I have installed PHP 5.6version, so how can I enable this module in apache. I cannot install the standar version of PHP, I need this one for the mentioned reason. Thanks!
Apache needs a PHP module to execute PHP. In some distros (Debian, etc.) there is a specific package for this. In Ubuntu: libapache2-mod-php5
It does not impact the php installation install but only adds the apache module.
Once installed, one only need to activate the module.

Categories