PECL install no releases available – Pecl

by
Ali Hasan
alpine-linux boot2docker composer-php mongodb pecl

Quick Fix: To resolve this issue, you can try the following steps:

  1. Run the commands:
pecl install --offline ./mongodb-1.4.2.tgz``` 

The Problem:

A user is trying to install the mongodb extension for PHP using PECL, but the installation fails with the error message "No releases available for package "pecl.php.net/mongodb"". The user suspects that this may be due to a certificate issue, as attempting to connect to the pecl.php.net server via wget results in a "certificate verification failed: certificate has expired" error.

The Solutions:

Solution 1: Use –no-check-certificate flag

The certificate of pecl.php.net has expired, so the base image used doesn’t have the appropriate certificate information. To solve the issue, the following command can be used:

wget --no-check-certificate https://pecl.php.net/get/mongodb-1.4.2.tgz
pecl install --offline ./mongodb-1.4.2.tgz

This will download the required package without checking the server’s certificate, and then install it using pecl install --offline.

Solution: Remove outdated certificates

The issue of "No releases available for package "pecl.php.net/mongodb"" can be resolved by removing the outdated certificates from the docker image. This can be achieved by:

  1. Identifying the offending certificate using the command:
grep -r Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ /etc
  1. Patching the /etc/ssl/certs/ca-certificates.crt and /etc/ssl/cert.pem files with the provided patches.

  2. Removing the remaining certificate files: /etc/ssl/certs/2e5ac55d.0 and /etc/ssl/certs/ca-cert-DST_Root_CA_X3.pem.

After performing these steps, the PECL installation should work correctly.

Solution 3: Certificate Verification Workaround

If pecl installation fails due to certificate verification errors, you can use the following workaround to bypass the SSL check and install the package offline:

pecl install apcu || (
    wget --no-check-certificate https://pecl.php.net/get/APCu -O ./apcu_latest.tgz
    pecl install --offline ./apcu_latest.tgz
    rm ./apcu_latest.tgz
)

This will download the latest version of the package and install it offline, without relying on SSL verification. However, it’s important to note that bypassing SSL checks is not recommended for production environments, as it poses security risks.

Q&A

Error – No releases available for package "pecl.php.net/mongodb"

Your base image is too old. I’d recommend not using such old versions and then it won’t be a problem.

Error – certificate has expired – ssl_client: pecl.php.net: certificate verification failed: certificate has expired

Wget will download, bypassing ssl, then install it using pecl.

Error – No releases available for package "pecl.php.net/apcu"

APT-get can be used to install various items, including CA Certificates, then use pecl to install the package.

Video Explanation:

The following video, titled "Install and Configure MongoDB with PHP on Windows - YouTube", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

MongoDB #PHP #Windows Full steps can be found at https://i12bretro.github.io/tutorials/0392.html ...