|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-01-27 07:22 UTC] info at sperlingprog dot com
Description:
------------
getenv("COMPUTERNAME") gets no result anymore
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 23 09:00:01 2025 UTC |
$PCNAME = strtoupper(getenv("COMPUTERNAME")); getenv returns no result or returns a empty string expected: the name of Windows PC (COMPUTERNAME) the same line in php 7 works as expectedHmm, works for me with the CLI Sapi. Which SAPI/Webserver do you use? Also make sure to check the output of var_dump(getenv("COMPUTERNAME")) Does you COMPUTERNAME contain non-ASCII characters?in phpinfo(); is no entry 'COMPUTERNAME' under Environment var_dump(getenv("COMPUTERNAME")) => bool(false) apache 2.4 php8 32 bit ScriptAlias /php8 "C:/web/php8_32bit" <Directory "C:/web/php8_32bit"> AllowOverride None Options None Require all denied <Files "php-cgi.exe"> Require all granted </Files> </Directory> <Directory "C:\web\Apache24\htdocs\burz_auftraege"> UnsetEnv PHPRC <FilesMatch "\.php$"> SetHandler application/x-httpd-php8 Action application/x-httpd-php8 "/php8/php-cgi.exe" </FilesMatch> </Directory> my PCNMAE is 'SPERLINGPROG' __________________________________________________ with php7 ( same apache ) it works but over: LoadModule php7_module "C:\web\php7_32bit\php7apache2_4.dll"