apt-get : Identify all old version numbers of a package? - php

I need to install PHP 5.3 on Debian. If I were to perform a regular install of PHP I would get version 5.4.
I understand that I can run apt-get install <package-name>=<package-version-number> to install a specific version. But I don't know what the exact package version number is for PHP 5.3.
I've ran apt-cache showpkg php5 and apt-cache madison php5 but they only list the current version.
How can I identify the correct version number to use to install PHP 5.3?

I have no idea if it's available in some apt command, but you can get the full list here: http://snapshot.debian.org/package/php5/
It seems the latest PHP 5.3 for Debian is 5.3.10-2: http://snapshot.debian.org/package/php5/5.3.10-2/
To install a package from snapshot, you have to add an entry to your /etc/apt/sources.list matching the packages you want, this entry can be found in the "pool" link. For instance, for php5 5.3.10-2 the pool link is http://snapshot.debian.org/archive/debian/20120221T041601Z/pool/main/p/php5/ so you need to add http://snapshot.debian.org/archive/debian/20120221T041601Z/ to you sources.list:
deb http://snapshot.debian.org/archive/debian/20120221T041601Z/ unstable main
deb-src http://snapshot.debian.org/archive/debian/20120221T041601Z/ unstable main
Those entries needs to be set to unstable, that's because snapshots give you the first time the packages apparead in the debian packages, and most often that's in unstable (but I guess it could be on experimental as well).
Next you need to update while telling apt to ignore packages expiration date:
apt-get -o Acquire::Check-Valid-Until=false update
If you're using aptitude, that's:
aptitude -o Acquire::Check-Valid-Until=false update
Now you can install your specific version of php5:
apt-get install php5=5.3.10-2
Now, as you added an unstable repository to your installation, you may want to set priority to stable packages, see: http://www.imped.net/2007/07/20/apt-pinning-installing-unstable-packages-on-stable-debian/

Related

What's the purpose of ppa:ondrej/nginx?

I've juste add ppa:ondrej/php on my ubuntu server, and it prompt me the message below.
Why am I advised to add ppa:ondrej/nginx (stable) too? What's the exact purpose of this?
For information I have already installed Nginx from the official doc.
$ sudo add-apt-repository ppa:ondrej/php
Note: PPA publishes dbgsym
You need to add 'main/debug' component to install the ddebs,
but apt update will print warning if the PPA has no ddebs
Repository: 'deb http://ppa.launchpad.net/ondrej/php/ubuntu/ groovy main'
Description:
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
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
I don't know very well the Personal Package Archives (PPA), so I would appreciate some help about how it works.
Also, ppa:ondrej/nginx includes brotli nginx module, which is not included into the official Ubuntu nginx packages, making this ppa very useful nowadays as brotli is supported by majority of browsers and offers better compression than gzip.
Additionally, it's the latest stable version (for instance, the official Ubuntu:focal repository has nginx 1.18, but ppa:ondrej/nginx has nginx 1.20).
According to the homepage for ppa:ondrej/nginx, here the PPA description:
This branch follows latest NGINX Stable packages compiled against latest OpenSSL for HTTP/2 and TLS 1.3 support.
BUGS&FEATURES: This PPA now has a issue tracker: https://deb.sury.org/#bug-reporting
PLEASE READ: If you like my work and want to give me a little motivation, please consider donating: https://donate.sury.org
So yes, same purpose as ppa:ondrej/php but to install up to date Nginx (stable) versions.

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

PHP 5.6 Repository URL for Ubuntu 14.04 Trusty

I have PHP 5.6.18-1+deb.sury.org~trusty+1 and am trying to update to 5.6.19. However, when I do apt-get update && apt-get upgrade, PHP does not get updated.
I have tried add-apt-repository ppa:ondrej/php5-5.6 as well as manually adding in deb http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu trusty main to my sources.list file to no avail.
How can I update PHP to 5.6.19 and make sure I don't run into this problem again in the future?
The ppa:ondrej/php5-5.6 repository is discontinued in favour of just ppa:ondrej/php. At the time of writing, this gives me an up-to-date version of PHP 5.6:
php --version
PHP 5.6.27-1+deb.sury.org~trusty+1
Note that, once you've added the repository, you'll need to uninstall any packages beginning php5* and reinstall php5.6* equivalents; also, you will probably have to switch Apache modules. More information on some of the steps required on this blogpost.
Note that, because of the quirk of the package maintainer's name containing a non-ASCII character, you might also need to install e.g. language-pack-en to fix all your server locales first. There's some other suggestions of what to do on this ServerFault question but for me it was trivial to install the language pack and let that take care of all locale settings.

How to install PHP5 with pthreads on Ubuntu?

I have a server which has PHP5 installed. I need pthreads and found that link to install php5 with pthreads:
PHP5 installation with pthreads
I install all the packages I need with apt-get install. I have no idea about what a make file is, how to compile a source code etc. I am a web developer with limited OS knowledge.
I have followed the steps given in the link above. At the last command on step 4, I get an error because /opt/php-zts/modules.d/ does not exist.
I simply wanted to replace existing php with a new php installation that supports pthreads. Now, the server code does not work.
How can I install PHP5 with pthreads enabled so that it will replace existing PHP5 installation that I installed with sudo apt-get install php5 libapache2-mod-php5?
Also, I have another question. I need some other packages like php-curl. Can I install them with sudo apt-get install php-curl after I succesfully install PHP? Do these commands work with custom builds?
Edit: how-to-install-pthread-in-ubuntu-12-10 This is not a solution for my problem because I don't want an isolated installation. I want the installation to replace already existing php installation.

Installing PEAR

phpinfo() function shows that my PHP version (5.1.6) is installed --without-pear in the configure command section.
How do I install pear?
The Getting and installing the PEAR package manager page should help you : it gives informations on how to install the PEAR package manager, on both windows, Linux, and Mac.
Basically, if your Linux distribution comes with a PEAP package, you should install it.
For instance, on Ubuntu1, there is a php-pear package ; so, you'd use :
apt-get install php-pear
Else, if it doesn't, with a version of PHP >= 5.3, you should be able to use this :
$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar
With PHP 5.1, though, this is not going to work, as phar support has been added in PHP 5.3...
As a sidenote : PHP 5.1 is really outdated !
PHP 5.3 is more than one year and a half old ; even PHP 5.2 is not maintained anymore... maybe you should consider upgrading ?
1It seems you are running some kind of Redhat-based distribution, but I don't have one of those, so I cannot say if there is a PEAR package for it -- there is probably one, though.
--without-pear only means that the PEAR bits were not immediately created when PHP was compiled.
This usually happens when an operating system vendor that provides packages and wants to split off bits and pieces into their own individually installable parts.
Given the age of the PHP you're talking about, you're probably on RHEL or a derivative like CentOS. Check the package manager for a php-pear package.

Categories