on my Win 10 machine i would like to use PHP on IIS. I went through different tutorials to get it to work but currently when i call the index.php file i got an blank page and the response is only the content of the php file (see this in browser dev tools).
content of the file:
`
<?php
phpinfo();
?>
`
Result
what i have done is:
installed CGI under Windows features
php 8.1.2 x86 Non thread safe unzipped under C:\php
php.ini adjusted like described in the tutorial(s)
linked the directory under environment variables to C:\php
set the handler mapping for php in IIS
checked the fast cgi module in IIS
I also activated the Failed Requested Trace in IIS and the outcoming log had following section:
For me it looks good, or i am wrong? If its helpful i can post the whole .xml, but it is very large.
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>4</Level>
<Opcode>43</Opcode>
<Keywords>0x0</Keywords>
<TimeCreated SystemTime="2022-11-15T15:58:47.038Z"/>
<Correlation ActivityID="{8000000A-0005-FF00-B63F-84710C7967BB}"/>
<Execution ProcessID="5540" ThreadID="1392"/>
<Computer>SRV01</Computer>
</System>
<EventData>
<Data Name="ContextId">{8000000A-0005-FF00-B63F-84710C7967BB}</Data>
<Data Name="OldHandlerName"></Data>
<Data Name="NewHandlerName">PHP_via_FastCGI</Data>
<Data Name="NewHandlerModules">FastCgiModule</Data>
<Data Name="NewHandlerScriptProcessor">C:\php\php-cgi.exe</Data>
<Data Name="NewHandlerType"></Data>
</EventData>
<RenderingInfo Culture="de-DE">
<Opcode>HANDLER_CHANGED</Opcode>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{D42CF7EF-DE92-473E-8B6C-621EA663113A}</EventGuid>
</ExtendedTracingInfo>
</Event>
I have a Windows 2008 VPS. I have installed IIS on it.
PHP stops working randomly on my IIS Windows 2008 server with no error.
I created a ticket with my hosting provider, they are saying -
As discussed, we could see PHP error in event-log:
https://forums.iis.net/t/1174646.aspx?Faulting+application+php+cgi+exe+version+5+2+14+14+time+stamp+0x4c4eabdc+faulting+module+xxxxxx
https://www.experts-exchange.com/questions/29049180/Faulting-application-name-php-cgi-exe-Exception-code-0xc0000005.html
------------------------------------
Log Name: Application
Source: Application Error
Date: 30-06-2018 22:30:30
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: Sapphire33615rb
Description:
Faulting application php-cgi.exe, version 5.5.38.0, time stamp 0x578fc02c, faulting module kernel32.dll, version 6.0.6002.19623, time
stamp 0x56ec36ff, exception code 0xc0000005, fault offset 0x0003fdb6,
process id 0x1dfc, application start time 0x01d410921634bfc2.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>100</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2018-06-30T17:00:30.000Z" />
<EventRecordID>980539</EventRecordID>
<Channel>Application</Channel>
<Computer>Sapphire33615rb</Computer>
<Security />
</System>
<EventData>
<Data>php-cgi.exe</Data>
<Data>5.5.38.0</Data>
<Data>578fc02c</Data>
<Data>kernel32.dll</Data>
<Data>6.0.6002.19623</Data>
<Data>56ec36ff</Data>
<Data>c0000005</Data>
<Data>0003fdb6</Data>
<Data>1dfc</Data>
<Data>01d410921634bfc2</Data>
</EventData>
</Event>
You can create dump file of w3wp.exe and it will create dump file at C:\Users\Administrator\AppData\Local\Temp\2 for further analysis.
I don't see any error in my PHP log files.
phpcs is installed on the system and code sniffing works fine from the command line.
phpcs --extensions=php /path/to/code.php`
^ works fine.
For the PHP Storm IDE, I've specified the location of the ruleset.xml file in the settings like so:
Cmd + , > PHP Code Sniffer validation > Coding standard > Custom > Path to ruleset.xml
However, I get this error:
PHP Code Sniffer
phpcs: /Users/gketkar/code-sniffer/Blah/ruleset.xml: line 1: syntax error near unexpected token `newline'
/Users/gketkar/code-sniffer/Blah/ruleset.xml: line 1: `<?xml version="1.0"?>'
UPDATE:
The ruleset.xml file looks like this:
<?xml version="1.0"?>
<ruleset name="Blah">
<description>Blah Coding Standards</description>
<rule ref="Generic">
<exclude name="Generic.Formatting.SpaceAfterCast.NoSpace"/>
<exclude name="Generic.PHP.DeprecatedFunctions"/>
<exclude name="Generic.PHP.DisallowShortOpenTag.EchoFound"/>
<exclude name="Generic.PHP.UpperCaseConstant.Found"/>
</rule>
</ruleset>
This looks like you have the ruleset.xml loaded into the setting that should have the phpcs binary. In PHPStorm:
Open preferences
Navigate to Language & Frameworks > PHP > Code
Sniffer
Click the [...] next to the configuration
Validate the path to the phpcs
Make sure that path points to a phpcs file and not the ruleset.xml file. If you don't have one, try https://packagist.org/packages/squizlabs/php_codesniffer
I am trying to fire off a Tsung request from my Mac OS X machine and i'm not having much luck.
I have edited the ~/.tsung/tsung.xml config file and even tried changing the location of that file on several occasions with the -f parameter.
When I run tsung start it returns this output
dave:/Applications/MAMP/htdocs/barebonessite/wp-content/themes/barebones $ tsung -f ~/.tsung/tsung.xml -l . start
Starting Tsung
"Log directory is: /Applications/MAMP/htdocs/barebonessite/wp- content/themes/barebones/./20130503-1325"
Config Error, aborting ! {{case_clause,{error,enoent}},
[{xmerl_scan,fetch_DTD,2,
[{file,"xmerl_scan.erl"},{line,1283}]},
{xmerl_scan,scan_doctype2,3,
[{file,"xmerl_scan.erl"},{line,1227}]},
{xmerl_scan,scan_prolog,4,
[{file,"xmerl_scan.erl"},{line,722}]},
{xmerl_scan,scan_document,2,
[{file,"xmerl_scan.erl"},{line,563}]},
{xmerl_scan,file,2,
[{file,"xmerl_scan.erl"},{line,249}]},
{ts_config,read,2,
[{file,"src/tsung_controller/ts_config.erl"},
{line,68}]},
{ts_config_server,handle_call,3,
[{file,
"src/tsung_controller/ts_config_server.erl"},
{line,198}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,588}]}]}
My config file looks like this:
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
<clients>
<client host='localhost' use_controller_vm='true'/>
</clients>
<servers>
<server host="54.225.212.193" port="80" type="tcp"></server
</servers>
<load>
<arrivalphase phase="1" duration="10" unit="minute">
<users maxnumber="650" arrivalrate="8" unit="second"/>
</arrivalphase>
</load>
<sessions>
<session probability="100" name="ab" type="ts_http">
<for from="1" to="20" var="i">
<request> <http url="/" method="GET" version="1.1"/> </request>
</for>
</session>
</sessions>
</tsung>
Being new to Tsung I cannot work out the problem here and the error reporting is pretty low level stuff and makes little sense.
I used Homebrew to install tsung on osx and was getting this error when using the example xml files.
Config Error, aborting ! dtd_not_found
Replacing the doc type line with this fixed it:
<!DOCTYPE tsung SYSTEM "/usr/local/Cellar/tsung/1.6.0/share/tsung/tsung-1.0.dtd">
This error is related to a dtd file missing, could you check that the file /usr/share/tsung/tsung-1.0.dtd exists, it seems not.
Secondly your xml file seems to contains a syntax error on a non close tag
Regards
There might be another path in case you are using some other Linux distributions (not mac os):
/usr/local/share/tsung/tsung-1.0.dtd
note local part
I've followed the directions here: Using FastCGI to Host PHP Applications on IIS 7 to configure Windows 2008, PHP with IIS 7 and FastCGI, and I'm running into issues. The PHP version is 5.3.8. I've setup the Handler Mappings on IIS, and created a test page, though the page doesn't return anything except for a 500 error. I've ensured that PHP works, from the command line I get a response when I enter:
php -version.
That said, I've turned on Failed Request Tracing Rules for php pages, and when I browse through the error log, I see things like:
<EventData>
<Data Name="ContextId">{00000000-0000-0000-0200-0080010000F6}</Data>
<Data Name="ModuleName">FastCgiModule</Data>
<Data Name="Data1">FASTCGI_RESPONSE_ERROR</Data>
<Data Name="Data2">PHP Warning: phpinfo() [<a href='function.phpinfo'>function.phpinfo</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-4.0/DST' instead in C:\inetpub\wwwroot\phpinfo.php on line 1
</Data>
<Data Name="ErrorCode">5</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>MODULE_WARNING</Opcode>
<Keywords>
<Keyword>Module</Keyword>
</Keywords>
<freb:Description Data="ErrorCode">Access is denied.
(0x5)</freb:Description>
From the top of the failed request log, I can see it's running under IUSR account:
tokenUserName="NT AUTHORITY\IUSR"
Here's settings for the fastCgi:
<fastCgi>
<application fullPath="C:\PHP\php-cgi.exe" instanceMaxRequests="10000">
<environmentVariables>
<environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
<environmentVariable name="PHPRC" value="C:\php\php.ini" />
</environmentVariables>
</application>
</fastCgi>
<handlers accessPolicy="Read, Script">
<add name="PHP via FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe" resourceType="Unspecified" requireAccess="Script" />
I've ensure that this user name has full control over my C:\PHP directory. My php.ini file is configured within C:\PHP directory.
In addition to following the directions in that article, I also tried to create a script map for PHP, and when I created that I got a difference error, not a 500.
HTTP Error 403.1 - Forbidden
You have attempted to run a CGI, ISAPI, or other executable program from a directory that does not allow executables to run.
Once again though, IUSR has full control over that directory so I don't quite understand why that error message.
Update
The issue was glaring right at me in the log. I had ignored the PHP Warning with regard to the date.timezone thinking that it's just a warning. I set it to:
date.timezone = America/New_York
and now it works.
For future reference you can use http://php.iis.net/ to easily install php into your IIS setup. It comes with a manager which will also let you go into 'development mode' which will display php errors as opposed to covering them up.