Skip to content

Indication for the int size in phpinfo() #12188

Closed

Description

@dtdesign

Description

The majority of PHP installations are compiled with support for 64-bit values, but there is still a considerable amount of environments out there that only support 32-bit values for whatever reason. Defining support for 64-bit values in the system requirements of a software is the obvious choice here, but revealed an important shortcoming: The support int size isn’t documented in the phpinfo().

This is a problem for the average user because they cannot tell that themselves unless they run a script that compares against \PHP_INT_SIZE. The difference here to all other system requirements like installed PHP extensions or configuration settings is that those are visible through the phpinfo() output.

It could be helpful to include some sort of an indication of the int size, be it the raw value of \PHP_INT_SIZE or a more “human friendly” readout like “32-bit”.

Activity

  1. remicollet commented on Sep 12, 2023

    @remicollet
    Member

    Can't you use PHP_BUILD_ARCH ?
    It is commonly used on Linux

    phpinfo()
    PHP Version => 8.1.23
    
    System => Linux builder.remirepo.net 6.4.13-100.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 30 16:43:51 UTC 2023 x86_64
    Build Date => Aug 30 2023 08:23:26
    Build System => Fedora release 37 (Thirty Seven)
    Build Provider => Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine
    Compiler => gcc (GCC) 12.3.1 20230508 (Red Hat 12.3.1-1)
    Architecture => x86_64
    Server API => Command Line Interface
    ...
    
  2. dtdesign commented on Sep 12, 2023

    @dtdesign
    Author

    This appears to be not reliably present. For comparison I have looked up the live phpinfo() examples for PHP 8.2 from both Host Europe and Hetzner. None of them show the architecture and the only reference to 64-bit at all is found in both the “System” and “Build System” strings but neither of that is a reliable indicator if it is 32-bit or 64-bit build of PHP. Please feel free to correct me if I’m wrong here.

  3. remicollet commented on Sep 12, 2023

    @remicollet
    Member

    Indeed, Architecture and other helpers useful for support are to be set by the build provider

    • PHP_UNAME
    • PHP_BUILD_SYSTEM
    • PHP_BUILD_PROVIDER
    • PHP_BUILD_COMPILER
    • PHP_BUILD_ARCH

    Perhaps you should ask these providers to set them properly?

    Else, this seems very specific to Windows

  4. dtdesign commented on Sep 12, 2023

    @dtdesign
    Author

    That is clearly some useful information, but I don’t think this overlaps with the issue at hand. Frankly speaking, build providers are often times some small shared hosting companies that I like to describe with a lot of adjectives and none of them include “competent”.

    I’m arguing entirely from the perspective of an ISV that has to deal with N customers hosting on N+1 different providers. The maximum supported integer size is something that is known to PHP at this point so there is already a reliable source of truth that does not depend on the build provider at all.

  5. added a commit that references this issue on Sep 14, 2023
    b2d244a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions