Bug #76529 [NEW]: php-cgi: -C option ignored
| From: | shhsu at microsoft dot com | Date: | Mon, 25 Jun 2018 20:36:59 +0000 |
| Subject: | Bug #76529 [NEW]: php-cgi: -C option ignored | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-215971@lists.php.net to get a copy of this message | ||
From: shhsu at microsoft dot com
Operating system: Windows
PHP version: 7.2.7
Package: *General Issues
Bug Type: Bug
Bug description:php-cgi: -C option ignored
Description:
------------
Hi
We are trying to benchmark PHP performance under IIS. We noticed that
PHP is trying to chdir to script directory and that is causing a lot of
contention because it's IO bound.
To workaround this. I tried to pass "-C" option to php-cgi.exe. (Process
run as: "php-cgi.exe -C" However, I am still observing chdir taking
place.
P.S. I noticed that php_execute_script
(https://github.com/php/php-src/blob/5f58f5ccf0909a90baef1280c3826f96b8e133ee/main/main.c#L2496)
gets executed before zend_first_try
(https://github.com/php/php-src/blob/5f58f5ccf0909a90baef1280c3826f96b8e133ee/sapi/cgi/cgi_main.c#L2356)
where the -C option is processed. Not sure if this is by design.
Test script:
---------------
Setup PHP for IIS. Add the following configuration
</system.webServer>
<fastCgi>
<application
fullPath="C:\php-7.2.7-nts-Win32-VC15\php-cgi.exe" arguments="-C"
maxInstances="10" instanceMaxRequests="10000000"
queueLength="10000">
<environmentVariables>
<environmentVariable name="PHP_FCGI_MAX_REQUESTS"
value="10000000" />
<environmentVariable name="PHPRC"
value="C:\php-7.2.7-nts-Win32-VC15" />
</environmentVariables>
</application>
</fastCgi>
</system.webServer>
<location path="" overrideMode="Allow">
<system.webServer>
<handlers accessPolicy="Read, Script">
<add name="PHP-iisfcgi" path="*.php"
verb="GET,HEAD,POST" modules="FastCgiModule"
scriptProcessor="C:\php-7.2.7-nts-Win32-VC15\php-cgi.exe|-C"
resourceType="Either" />
</system.webServer>
....
</location>
Expected result:
----------------
If I execute php-cgi with -C, no chdir to script path should take place
Actual result:
--------------
chdir to script path
--
Edit bug report at https://bugs.php.net/bug.php?id=76529&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76529&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76529&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76529&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76529&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76529&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76529&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76529&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76529&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76529&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76529&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76529&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76529&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76529&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76529&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76529&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76529&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76529&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76529&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76529&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76529&r=mysqlcfg