Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Unit building PHP modules. Version confusion. #1007

Closed

Description

@skillslasher

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

Activity

  1. thresheek commented on Nov 16, 2023

    @thresheek
    Member

    Hi @skillslasher, you'd also need to specify a proper path to php7.4-config, via --config option.

  2. skillslasher commented on Nov 16, 2023

    @skillslasher
    Author

    Hi @thresheek I've had the same idea before, but it raises an error.
    ./configure: error: no PHP found.

  3. thresheek commented on Nov 16, 2023

    @thresheek
    Member

    Please check the build/autoconf.err file for the issues encountered then, it should have the information on why it wasnt found.

  4. skillslasher commented on Nov 16, 2023

    @skillslasher
    Author

    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

  5. thresheek commented on Nov 16, 2023

    @thresheek
    Member

    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?

  6. skillslasher commented on Nov 17, 2023

    @skillslasher
    Author

    @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.

  7. added
    z-phpLanguage-Module for PHP (SAPI)
    on Dec 1, 2023
  8. tippexs commented on Dec 6, 2023

    @tippexs
    Contributor

    @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?

  9. locked and limited conversation to collaborators on Jan 18, 2024
  10. converted this issue into a discussion #1072 on Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    z-phpLanguage-Module for PHP (SAPI)z-question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions