You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
Unit building PHP modules. Version confusion. #1007
When trying to build modules for PHP of different versions, at the moment of configuring the build, the latest PHP package is picked up, not the one specified in the configuration parameters.
For example.
The system has php7.4, php8.1, php8.2 installed. ./configure php --module=php7.4 --config=php-config --lib-path=/usr/lib/php/7.4/sapi
configuring PHP module
checking for PHP ... found
PHP SAPI: [apache2handler embed cgi cli fpm]
checking for PHP version ... 8.2.12
checking for PHP embed SAPI ... found
checking for PHP Zend Thread Safety ... not found
checking for PHP zend_signal_startup() ... found
PHP module: php7.4.unit.so
With these ./configure settings, it will still pick up the most recent package on the system, which is php8.2
Naturally, such a module does not work properly afterwards.
Forcing the default PHP interpreter to be changed to php7.4 did nothing.
Can you please tell me how to fix the problem?
System: Ubuntu 22.04.3.
Unit version 1.31.1
PHP 7.4.33
PHP 8.1.25
PHP 8.2.12
checking for PHP zend_signal_startup()
configuring PHP module ...
checking for PHP ...
/bin/sh: 1: php7.4-config: not found
configuring PHP module ...
checking for PHP ...
8.2.12
I tried to find this file on the system, but it doesn't exist. I don't know where he's supposed to be either. The Unit's documentation states simply --config=php-config.
Well, you need to specify a proper path to php-config (or similarly named executable) that corresponds to PHP 7.4 - typically found in packages named like "php7.4-dev". Probably prior you had the default set to it.
Looking at Ubuntu packages, though, I don't see 7.4 in 22.04, only in 20.04: https://packages.ubuntu.com/search?keywords=php7.4-dev so I'm not sure where it can be found on your system - probably a self-installed PHP from somewhere else?
@thresheek Thank you so much, for your help and advice. Yeah, I found it. This file. It was called php-config7.4 And similar for the rest of the packages.
@skillslasher sorry for comming back to this a little late but before closing it - would you say there are some missing steps in our documentation about building PHP modules? Is there anything we can improve that would helped you doing it right in the first place?
Activity
thresheek commentedon Nov 16, 2023
Hi @skillslasher, you'd also need to specify a proper path to php7.4-config, via --config option.
skillslasher commentedon Nov 16, 2023
Hi @thresheek I've had the same idea before, but it raises an error.
./configure: error: no PHP found.
thresheek commentedon Nov 16, 2023
Please check the
build/autoconf.errfile for the issues encountered then, it should have the information on why it wasnt found.skillslasher commentedon Nov 16, 2023
All I found in this file is this:
checking for PHP zend_signal_startup()
configuring PHP module ...
checking for PHP ...
/bin/sh: 1: php7.4-config: not found
configuring PHP module ...
checking for PHP ...
8.2.12
I tried to find this file on the system, but it doesn't exist. I don't know where he's supposed to be either. The Unit's documentation states simply
--config=php-config.It worked like this with past versions of Unit
thresheek commentedon Nov 16, 2023
Well, you need to specify a proper path to
php-config(or similarly named executable) that corresponds to PHP 7.4 - typically found in packages named like "php7.4-dev". Probably prior you had the default set to it.Looking at Ubuntu packages, though, I don't see 7.4 in 22.04, only in 20.04: https://packages.ubuntu.com/search?keywords=php7.4-dev so I'm not sure where it can be found on your system - probably a self-installed PHP from somewhere else?
skillslasher commentedon Nov 17, 2023
@thresheek Thank you so much, for your help and advice. Yeah, I found it. This file. It was called
php-config7.4And similar for the rest of the packages.tippexs commentedon Dec 6, 2023
@skillslasher sorry for comming back to this a little late but before closing it - would you say there are some missing steps in our documentation about building PHP modules? Is there anything we can improve that would helped you doing it right in the first place?