Skip to content

Indication for the int size in phpinfo() #12188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dtdesign opened this issue Sep 12, 2023 · 4 comments · Fixed by #12201
Closed

Indication for the int size in phpinfo() #12188

dtdesign opened this issue Sep 12, 2023 · 4 comments · Fixed by #12201

Comments

@dtdesign
Copy link

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

@remicollet
Copy link
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
...

@dtdesign
Copy link
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.

@remicollet
Copy link
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

@dtdesign
Copy link
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.

TimWolla added a commit to WoltLab/php-src that referenced this issue Sep 13, 2023
TimWolla added a commit to WoltLab/php-src that referenced this issue Sep 14, 2023
TimWolla added a commit that referenced this issue Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants