Dealing with php5.4 on Ubuntu Trusty - php

I would like to have php 5.4 on my ubuntu server, even if it's no longer supported.
Then I tried the ppa:ondrej/php5-oldstable repository like this :
sudo add-apt-repository ppa:ondrej/php5-oldstable
But it adds the repository below
[ubuntu#nixmind~]$ cat /etc/apt/sources.list.d/ondrej-php5-oldstable-trusty.list
deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main
# deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty
main
and was still giving php5.5.9 with apt-cache policy.
[ubuntu#nixmind ~]$ apt-cache policy php5
php5:
Installed: 5.4.45-3+donate.sury.org~precise+3
Candidate: 5.5.9+dfsg-1ubuntu4.17
Version table:
5.5.9+dfsg-1ubuntu4.17 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
5.5.9+dfsg-1ubuntu4 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
I then add the precise repos manually like this :
[ubuntu#nixmind ~]$ cat /etc/apt/sources.list.d/ondrej-php5-oldstable-trusty.list
deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main
deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu precise main
deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu precise main
# deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main
and had this :
[ubuntu#nixmind ~]$ apt-cache policy php5
php5:
Installed: (none)
Candidate: 5.5.9+dfsg-1ubuntu4.17
Version table:
5.5.9+dfsg-1ubuntu4.17 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
5.5.9+dfsg-1ubuntu4 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
5.4.45-3+donate.sury.org~precise+3 0
500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
I then installed php5.4 like this :
sudo apt-get install php5=5.4.45-3+donate.sury.org~precise+3
But php is saying that the version is 5.5.9 while apt-cache policy says it's 5.4
[ubuntu#nixmind ~]$ apt-cache policy php5
php5:
Installed: 5.4.45-3+donate.sury.org~precise+3
Candidate: 5.5.9+dfsg-1ubuntu4.17
Version table:
5.5.9+dfsg-1ubuntu4.17 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
5.5.9+dfsg-1ubuntu4 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
*** 5.4.45-3+donate.sury.org~precise+3 0
500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
and
[ubuntu#nixmind ~]$ php -v
PHP 5.5.9-1ubuntu4.17 (cli) (built: May 19 2016 19:05:57)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
Then my questions are :
Why is there a difference between php -v and apt-cache policy
outputs?
Is it just not possible to install php5.4 on ubuntu trusty actually?
Is a good way to have php5?4 running on ubuntu trusty without this
ambiguity?
Regards.

Try Linuxbrew. It can install two or more PHP versions side by side.
It works for me on Linux Mint 17.3 (which is based on Ubuntu 14.04) with PHP 5.4, 5.5, 5.6, 7.0 and 7.1.
PHP 5.3 doesn't compile though :-(

Related

cURL not found in wordpress on AWS EC2 instance

On my Wordpress site the cURL command doesn't seem to work:
When I login into Wordpress, it clearly says cURL is not installed:
However, when I SSH into my EC2 instance, I shows that cURL is installed:
$ curl --version
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.3.0 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL
Because PHP is outdated, maybe it could be an PHP issue? When I check my PHP version, I shows I have the latest version installed:
$ php -v
PHP 8.2.1 (cli) (built: Jan 13 2023 10:42:21) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.1, Copyright (c) Zend Technologies
with Zend OPcache v8.2.1, Copyright (c), by Zend Technologies
But when I list all my PHP installs, I see that the top one corresponds with the one mentioned in Wordpress (7.3.33-9+ubuntu18.04.1+deb.sury.org+1):
$ dpkg --list | grep php
ii libapache2-mod-php7.3 7.3.33-9+ubuntu18.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii libapache2-mod-php8.2 8.2.1-2+ubuntu18.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii php 2:8.2+93+ubuntu18.04.1+deb.sury.org+2 all server-side, HTML-embedded scripting language (default)
ii php-common 2:93+ubuntu18.04.1+deb.sury.org+2 all Common files for PHP packages
ii php-curl 2:8.2+93+ubuntu18.04.1+deb.sury.org+2 all CURL module for PHP [default]
ii php-fpm 2:8.2+93+ubuntu18.04.1+deb.sury.org+2 all server-side, HTML-embedded scripting language (FPM-CGI binary) (default)
ii php-gd 2:8.2+93+ubuntu18.04.1+deb.sury.org+2 all GD module for PHP [default]
ii php-mbstring 2:8.2+93+ubuntu18.04.1+deb.sury.org+2 all MBSTRING module for PHP [default]
rc php7.0-curl 7.0.33-0ubuntu0.16.04.2 amd64 CURL module for PHP
ii php7.2-cli 7.2.34-37+ubuntu18.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php7.2-common 7.2.34-37+ubuntu18.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php7.2-curl 7.2.34-37+ubuntu18.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.2-fpm 7.2.34-37+ubuntu18.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.2-gd 7.2.34-37+ubuntu18.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php7.2-json 7.2.34-37+ubuntu18.04.1+deb.sury.org+1 amd64 JSON module for PHP
ii php7.2-mbstring 7.2.34-37+ubuntu18.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php7.2-mysql 7.2.34-37+ubuntu18.04.1+deb.sury.org+1 amd64 MySQL module for PHP
ii php7.2-opcache 7.2.34-37+ubuntu18.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php7.2-readline 7.2.34-37+ubuntu18.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php7.3 7.3.33-9+ubuntu18.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (metapackage)
ii php7.3-cli 7.3.33-9+ubuntu18.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php7.3-common 7.3.33-9+ubuntu18.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php7.3-json 7.3.33-9+ubuntu18.04.1+deb.sury.org+1 amd64 JSON module for PHP
ii php7.3-mysql 7.3.33-9+ubuntu18.04.1+deb.sury.org+1 amd64 MySQL module for PHP
ii php7.3-opcache 7.3.33-9+ubuntu18.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php7.3-readline 7.3.33-9+ubuntu18.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php8.2 8.2.1-2+ubuntu18.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (metapackage)
ii php8.2-cli 8.2.1-2+ubuntu18.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php8.2-common 8.2.1-2+ubuntu18.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php8.2-curl 8.2.1-2+ubuntu18.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php8.2-fpm 8.2.1-2+ubuntu18.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php8.2-gd 8.2.1-2+ubuntu18.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php8.2-mbstring 8.2.1-2+ubuntu18.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php8.2-opcache 8.2.1-2+ubuntu18.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php8.2-readline 8.2.1-2+ubuntu18.04.1+deb.sury.org+1 amd64 readline module for PHP
I've also tried rebooting from the AWS EC2 dashboard.
lel, you have php7.0-curl and php7.2-curl and php8.2-curl, but you run WordPress on the 1 php where you don't have curl: php7.3
sudo apt update;
sudo apt install php7.3-curl;
you should consider upgrading the php you run wordpress on though: PHP7.3 went EOL 6 desember 2021; by comparison, PHP8.2 is scheduled to go EOL 8 desember 2025.
it's very rare that you need any PHP5 version other than 5.6, and any PHP7 version other than 7.4, i suggest you install php7.4 and uninstall 7.0, 7.2, and 7.3.

Azure Web Apps Composer Fail (GD Extension) [duplicate]

I newly install Dompdf in Laravel Project via Composer (composer require barryvdh/laravel-dompdf). After enter the Command Terminal Reply Following Errors.
Problem 1
- dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- barryvdh/laravel-dompdf v0.7.0 requires dompdf/dompdf ^0.7 -> satisfiable by dompdf/dompdf[v0.7.0].
- Installation request for barryvdh/laravel-dompdf ^0.7.0 -> satisfiable by barryvdh/laravel-dompdf[v0.7.0].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/5.6/cli/php.ini
- /etc/php/5.6/cli/conf.d/10-opcache.ini
- /etc/php/5.6/cli/conf.d/10-pdo.ini
- /etc/php/5.6/cli/conf.d/15-xml.ini
- /etc/php/5.6/cli/conf.d/20-calendar.ini
- /etc/php/5.6/cli/conf.d/20-ctype.ini
- /etc/php/5.6/cli/conf.d/20-dom.ini
- /etc/php/5.6/cli/conf.d/20-exif.ini
- /etc/php/5.6/cli/conf.d/20-fileinfo.ini
- /etc/php/5.6/cli/conf.d/20-ftp.ini
- /etc/php/5.6/cli/conf.d/20-gettext.ini
- /etc/php/5.6/cli/conf.d/20-iconv.ini
- /etc/php/5.6/cli/conf.d/20-json.ini
- /etc/php/5.6/cli/conf.d/20-mbstring.ini
- /etc/php/5.6/cli/conf.d/20-phar.ini
- /etc/php/5.6/cli/conf.d/20-posix.ini
- /etc/php/5.6/cli/conf.d/20-readline.ini
- /etc/php/5.6/cli/conf.d/20-shmop.ini
- /etc/php/5.6/cli/conf.d/20-simplexml.ini
- /etc/php/5.6/cli/conf.d/20-sockets.ini
- /etc/php/5.6/cli/conf.d/20-sysvmsg.ini
- /etc/php/5.6/cli/conf.d/20-sysvsem.ini
- /etc/php/5.6/cli/conf.d/20-sysvshm.ini
- /etc/php/5.6/cli/conf.d/20-tokenizer.ini
- /etc/php/5.6/cli/conf.d/20-wddx.ini
- /etc/php/5.6/cli/conf.d/20-xmlreader.ini
- /etc/php/5.6/cli/conf.d/20-xmlwriter.ini
- /etc/php/5.6/cli/conf.d/20-xsl.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
How to Solve this Error
I already Installed GD using Following comment. sudo apt-get install php5-gd and also Apache Server Restarted. My Laravel Version is 5.3 and Ubuntu Version is 14.04
I have installed php7, I did the following to solve exactly the same error
sudo apt-get install php7.0-gd
sudo apt-get install php7.0-intl
sudo apt-get install php7.0-xsl
If you are working in PHP version 5.* then you have to install
sudo apt-get install php5-gd
And if you are working in PHP version 7.* then you have to install
sudo apt-get install php7.0-gd
Hope it will work...
And if you are working in PHP version 7.2 then you have to install
sudo apt-get install php7.2-gd... it worked for me
For php-8, just locate your php.ini file and uncomment the line extension=gd
Below is a picture guide for those using Xampp and Windows
Step 1: Open php.ini or locate it in your machine (C:/xampp/php/php.ini)
Step 2: Uncomment the line extension=gd by removing the semicolon
Step 3: Save your file and restart your services
Open your php.ini and uncomment this line:
;extension=php_gd2.dll
It may not be enabled for php-cli, you can enable like this;
sudo phpenmod gd
UPDATE
I guess, you are using ppa:ondrej php package (5.6), which is confusing you with default ubuntu 14.04 php package (5.5.9).
To install php 5.6 gd library from ppa:ondrej, you should use:
sudo apt-get install php5.6-gd
PHP 7.4.2 (cli) (built: Feb 5 2020 16:50:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.2, Copyright (c), by Zend Technologies
For Php 7.4.2
sudo apt-get install php7.4-gd
sudo phpenmod gd
Before installing the missing dependency, you need to check which version of PHP is installed on your system.
php -v
PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
In this case it's php7.2. apt search php7.2 returns all the available PHP extensions.
apt search php7.2
Sorting... Done
Full Text Search... Done
libapache2-mod-php7.2/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
server-side, HTML-embedded scripting language (Apache 2 module)
libphp7.2-embed/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
HTML-embedded scripting language (Embedded SAPI library)
php-all-dev/bionic,bionic 1:60ubuntu1 all
package depending on all supported PHP development packages
php7.2/bionic-updates,bionic-updates,bionic-security,bionic-security 7.2.10-0ubuntu0.18.04.1 all
server-side, HTML-embedded scripting language (metapackage)
php7.2-bcmath/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Bcmath module for PHP
php7.2-bz2/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
bzip2 module for PHP
php7.2-cgi/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
server-side, HTML-embedded scripting language (CGI binary)
php7.2-cli/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
command-line interpreter for the PHP scripting language
php7.2-common/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
documentation, examples and common module for PHP
php7.2-curl/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
CURL module for PHP
php7.2-dba/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
DBA module for PHP
php7.2-dev/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Files for PHP7.2 module development
php7.2-enchant/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Enchant module for PHP
php7.2-fpm/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.2-gd/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
GD module for PHP
php7.2-gmp/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
GMP module for PHP
php7.2-imap/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
IMAP module for PHP
php7.2-interbase/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Interbase module for PHP
php7.2-intl/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Internationalisation module for PHP
php7.2-json/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
JSON module for PHP
php7.2-ldap/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
LDAP module for PHP
php7.2-mbstring/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
MBSTRING module for PHP
php7.2-mysql/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
MySQL module for PHP
php7.2-odbc/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
ODBC module for PHP
php7.2-opcache/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
Zend OpCache module for PHP
php7.2-pgsql/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
PostgreSQL module for PHP
php7.2-phpdbg/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
server-side, HTML-embedded scripting language (PHPDBG binary)
php7.2-pspell/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
pspell module for PHP
php7.2-readline/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
readline module for PHP
php7.2-recode/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
recode module for PHP
php7.2-snmp/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
SNMP module for PHP
php7.2-soap/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
SOAP module for PHP
php7.2-sqlite3/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
SQLite3 module for PHP
php7.2-sybase/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Sybase module for PHP
php7.2-tidy/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
tidy module for PHP
php7.2-xml/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.2-xmlrpc/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
XMLRPC-EPI module for PHP
php7.2-xsl/bionic-updates,bionic-updates,bionic-security,bionic-security 7.2.10-0ubuntu0.18.04.1 all
XSL module for PHP (dummy)
php7.2-zip/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Zip module for PHP
You can now proceed to installing the missing dependency by running:
sudo apt install php7.2-gd
if you are working in PHP version 7.2 then you have to install
sudo apt-get install php7.2-gd
For php 7.1
sudo apt-get install php7.1-gd
Cheers!
I'm working on php 8.0.9, and I just uncomment this on php.ini in xampp/php/php.ini directory.
from
;extension=gd
to
extension=gd
and it's work normal again
The solution is quite simple.
In your php.ini, just uncomment the line extension=php_gd2.dll (or .so extension for unix systems.)
Hope it helps.
This worked for me:
composer require "ext-gd:*" --ignore-platform-reqs
As of Composer 2.0 on Arch, I use: --ignore-platform-req=ext-gd
Eg:
php composer install -n --ignore-platform-req=ext-gd
Eg: (to ignore multiple requirements)
php composer install -n --ignore-platform-req=ext-gd --ignore-platform-req=ext-ldap
Ignoring Composer requirements may be necessary because Composer may return false warnings on dependencies that are already properly installed and enabled, consider this Arch forum article:
I have installed php-gd and uncommeted extension=gd.so in /etc/php/php.ini as the wiki says
Thanks for this answer on a related Question, How to always use ignore-platform-reqs flag when running composer?
Using Manjaro(Arch) Linux:
$ sudo pacman -S php-gd
In file /etc/php/php-ini, add the line:
extension=gd.so
For Windows :
Uncomment this line in your php.ini file
;extension=php_gd2.dll
If the above step doesn't work uncomment the following line as well:
;extension=gd2
sudo apt-get install php7.4-zip
Use your version of php. Like here I used 7.4
CentOS
sudo yum install php-gd
Unbuntu
sudo apt install php-gd
First Check your php version
sudo php -v
Then install php gd package of relevent version.
sudo apt-get install php${version}-gd
Finally run
composer update
On CentOS 7, try running following command:
sudo yum install php72u-gd.x86_64
in docker I found a same problem, even after
"rm /etc/apt/preferences.d/no-debian-php"
then
"apt update"
"apt install php7.4-gd"
"php composer.phar update"
error " ..... ext-gd ....."
so my solution is direct using php7.4
"php7.4 composer.phar update"
and its work. I dont know why.
It may help you
apt install php-xml
systemctl restart apache2
From reference here, you may learn in brief.
Thanks :)
On Local or Xampp in windows
go to : C:\xampp\php\php.ini
uncomment extension=gd
PHP VERSION - 7.3.21
WAMP SERVER
// use below command to fix ext-gd issue
// work for me
composer require "ext-gd:*" --ignore-platform-reqs phpoffice/phpspreadsheet

Cannot find php-curl package

I am struggling with the php-curl installation which cannot be found, I have seen plenty of topics related to it but it unfortunatelly did not help much. I want it for an curl function in a php program.
I tried it via adding ppa:ondrej/php repository, but I think it simply does not help much.
kali#kali$ sudo apt-get install php7.3
php7.3 php7.3-common php7.3-mysql php7.3-readline
php7.3-cli php7.3-json php7.3-opcache
kali#kali:$ sudo apt-get install php7.3-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.3-curl
E: Couldn't find any package by glob 'php7.3-curl'
E: Couldn't find any package by regex 'php7.3-curl'
kali#kali:$ sudo apt-get install php7-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7-curl
$ sudo apt-get install php-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php-curl
$ sudo add-apt-repository ppa:ondrej/php
Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.
Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa
You can get more information about the packages at https://deb.sury.org
IMPORTANT: The <foo>-backports is now required on older Ubuntu releases.
BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting
CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline
   or ppa:ondrej/nginx
PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/
WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:
# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keybox '/tmp/tmpfx71elke/pubring.gpg' created
gpg: /tmp/tmpfx71elke/trustdb.gpg: trustdb created
gpg: key 4F4EA0AAE5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
gpg: Total number processed: 1
gpg: imported: 1
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
gpg: no valid OpenPGP data found.
$ sudo apt-get update
Ign:1 http://ppa.launchpad.net/ondrej/php/ubuntu hirsute InRelease
Hit:2 https://download.docker.com/linux/debian buster InRelease
Err:3 http://ppa.launchpad.net/ondrej/php/ubuntu hirsute Release
404 Not Found [IP: 91.189.95.85 80]
Hit:4 http://kali.koyanet.lv/kali kali-rolling InRelease
Hit:5 https://packages.gitlab.com/gitlab/gitlab-ce/debian jessie InRelease
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/ondrej/php/ubuntu hirsute Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
$ sudo apt-get install php
php7.3 php7.3-common php7.3-mysql php7.3-readline php-defaults
php7.3-cli php7.3-json php7.3-opcache php-common php-mysql
///// still cannot see curl module
More info about versions and system running it:
My php version is 7.3.12
kali#kali:$ php -v
PHP 7.3.12-1 (cli) (built: Nov 28 2019 07:34:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.12, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.12-1, Copyright (c) 1999-2018, by Zend Technologies
kali#kali:$ apt list --installed | grep php
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libapache2-mod-php7.3/now 7.3.12-1 amd64 [installed,local]
libapache2-mod-php/now 2:7.3+69 all [installed,local]
php-common/now 2:69 all [installed,local]
php-mysql/now 2:7.3+69 all [installed,local]
php7.3-cli/now 7.3.12-1 amd64 [installed,local]
php7.3-common/now 7.3.12-1 amd64 [installed,local]
php7.3-json/now 7.3.12-1 amd64 [installed,local]
php7.3-mysql/now 7.3.12-1 amd64 [installed,local]
php7.3-opcache/now 7.3.12-1 amd64 [installed,local]
php7.3-readline/now 7.3.12-1 amd64 [installed,local]
php -m
[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
Kali version
$ uname -irv
5.4.0-kali3-amd64 #1 SMP Debian 5.4.13-1kali1 (2020-01-20) unknown
sources
$ cat /etc/apt/sources.list | grep -v "#"
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
I found there might have been some bugs
It was an issue with sources.list changed a lot time ago.
I updated it with other repositiories and it started working.
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb https://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
deb-src https://http.kali.org/kali kali-rolling main contrib non-free
Next I have run sudo apt-get update.
Now I am able to see all the packages that were missing before.

How to install PHP 7.1 yaml extension and not 7.2 on Ubuntu 16.04

I'm trying to install the yaml extension on Ubuntu.
I have PHP 7.1 on my server.
ubuntu#www1:~$ php -v
PHP 7.1.15-1+ubuntu14.04.1+deb.sury.org+2 (cli) (built: Mar 6 2018 11:27:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.15-1+ubuntu14.04.1+deb.sury.org+2, Copyright
(c) 1999-2018, by Zend Technologies
I was following another SO post that said to run
sudo apt install libyaml-dev php-dev php-pear
When I do that, the installer says, in part:
The following extra packages will be installed:
dh-php php7.2-cli php7.2-common php7.2-dev php7.2-json php7.2-opcache
php7.2-readline pkg-php-tools xml2
Suggested packages:
dh-make
The following NEW packages will be installed:
dh-php php-dev php7.2-cli php7.2-common php7.2-dev php7.2-json
php7.2-opcache php7.2-readline pkg-php-tools xml2
0 upgraded, 10 newly installed, 0 to remove and 85 not upgraded.
Need to get 3,073 kB of archives.
After this operation, 18.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
So, why would the installer install PHP 7.2 extensions on a PHP 7.1 server?
I aborted the install and came here to ask:
How do I force my server to stay at PHP 7.1 and install the yaml extension?
Have you tried
sudo apt-get install -y php7.1-yaml

Downgrade to PHP 5.4.45 in Phusion Docker

I'm running a dev environment using Docker and https://github.com/phusion/baseimage-docker.
I've tried installing PHP 5.4.45 on it, but I always get a PHP 5.5.9 version when running apt-cache policy php5.
Every guide uses sudo add-apt-repository ppa:ondrej/php5-oldstable, which I installed but it doesn't work..any ideas?
This is one of the guides I tried: https://www.dev-metal.com/how-to-install-latest-php-5-4-x-on-ubuntu-12-04-lts-precise-pangolin/
So the phusion:baseimage:latest will (at the moment) use Ubuntu 16.04.
The PHP 5.4 repository will only work with Ubuntu 12.04.
This is how I got it working:
1: Start a container based on Phusion 0.9.9 (which is based on Ubuntu 12.04):
docker run phusion/baseimage:0.9.9
2: Lookup the name of the container and enter it
3: run following commands:
apt-get update && apt-get install -y python-software-properties software-properties-common
export LC_ALL=en_US.UTF-8
add-apt-repository ppa:ondrej/php5-oldstable
apt-get update
apt-cache policy php5
4: output will be:
php5:
Installed: (none)
Candidate: 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1
Version table:
5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1 0
500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
5.3.10-1ubuntu3.25 0
500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
500 http://archive.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
5.3.10-1ubuntu3 0
500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

Categories