php extension enable, missing extension=pdo or all pro extensions should be absent

Bug #2015357 reported by James Trainor
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php-defaults (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

lsb_release -rd
Description: Ubuntu 22.04.2 LTS
Release: 22.04

apt-cache policy php
php:
  Installed: 2:8.1+92ubuntu1
  Candidate: 2:8.1+92ubuntu1
  Version table:
 *** 2:8.1+92ubuntu1 500
        500 http://ca.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

The php.ini file includes:

  ;extension=pdo_firebird
  ;extension=pdo_mysql
  ;extension=pdo_oci
  ;extension=pdo_odbc
  ;extension=pdo_pgsql
  ;extension=pdo_sqlite

If a user enables one of these (removes the ";") then they will get an "undefined symbol: php_pdo_register_driver in Unknown on line 0" when php starts because the "pdo" extension is not enabled. The ini file is missing "extension=pdo" above the database specific extensions. But beyond that, why are these even present at all because the "phpenmod" command is the new preferred method to enable extensions and it does that by creating links in /etc/php/8.1/apache2/conf.d such as:

  10-pdo.ini -> /etc/php/8.1/mods-available/pdo.ini
  20-pdo_sqlite.ini -> /etc/php/8.1/mods-available/pdo_sqlite.ini

If "phpenmod" is used to enable both pdo and, e.g. pro_sqlite, then the php.ini entries are not
necessary. If they are used used then a warning is issued about duplicate module init. Also, if the php.ini entries are used then the extension=pdo template entry is missing. Alternatively, the "extension=" entries in php.ini could be entirely removed and a comment added instructing users to use the "phpenmod" command.

Ideally, what I expect as a user in this case is to open php.ini file and to find a comment indicating that module configuration has changed and that users should use use "phpenmod" instead. That will help direct those migrating from an earlier php version.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: php 2:8.1+92ubuntu1
ProcVersionSignature: Ubuntu 5.15.0-69.76-generic 5.15.87
Uname: Linux 5.15.0-69-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.3
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Wed Apr 5 09:14:28 2023
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: php-defaults
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
James Trainor (snowblower) wrote :
Revision history for this message
Paride Legovini (paride) wrote :

Hello James and thanks for this bug report. I can see how those commented extension lines can be confusing, given that phpenmod should be preferred.

This issue is present in Debian too, and ideally it should be fixed there. This way Debian and downstream distributions other than Ubuntu will also benefit from the change, and we won't have to carry over a diff with respect to Debian, with the associated maintenance overhead.

Would you mind filing a bug with Debian please? Note that Debian already packages php8.1. Thanks!

Changed in php-defaults (Ubuntu):
status: New → Triaged
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.