PHP ignored [Answered]RSS

3 replies

Last post Mar 18, 2018 08:19 PM by lextm

  • PHP ignored

    Mar 17, 2018 09:05 AM|jaybeuu|LINK

    <div>Hi</div>

    I'm developing an IOT project where a client will run on a micro-controller and will be configured and fed data via a backend web server and database.  I'm a newbie when it comes to web servers but I successfully installed IIS & PHP on Windows 10.  Over several days I wrote a bunch of test web pages with embedded PHP to learn how to drive them.  The test pages did what was expected so all was well.  

    I then found that after a laptop reboot the test pages no longer worked - the HTML was executed OK but the embedded PHP scripts were ignored.  There are no IIS or PHP run time error messages.  I've checked the configuration of IIS and PHP and all seems fine as far as I can tell.   I would understand it if the test pages had never worked, as that would imply I'd got the installation wrong, but to have worked and then to stop working when there have been no changes seems strange.

    I don't know whether PHP runs as a background process listening for calls or whether IIS spawns it when it encounters PHP, but I can't see any background processes in Windows Task Manager that look like they're related to PHP.   I half expected to see php-cgi.exe running in the background as it's been defined as the FastCgi handler module in the IIS configuration.

    If I invoke any of the test pages from the command line using "php.exe filename.php" then the PHP code executes as expected (of course the HTML does not) - so at least php is working from the command line. 

    In case it's relevant I installed PHP using the instructions here. 

    Any suggestions appreciated.

  • Re: PHP ignored

    Mar 17, 2018 01:28 PM|lextm|LINK

    When Microsoft documents all the steps and tries to keep it up-to-date, it is clueless to follow a blog post which can easily miss some details or went out-of-date.

    Read it carefully and compare your system configuration to the desired,

    https://docs.microsoft.com/en-us/iis/application-frameworks/scenario-build-a-php-website-on-iis/configuring-step-1-install-iis-and-php#13-download-and-install-php-manually 

    Lex Li
    https://lextudio.com
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: PHP ignored

    Mar 17, 2018 10:20 PM|jaybeuu|LINK

    Thx  lextm.  I'd already come across the instructions you referenced, but they're quite old (April 2013) and I'd concluded they weren't appropriate.  There was nothing more recent from Microsoft so it's probably long overdue an update. The official PHP site describes an install for IIS and Windows 10 but it didn't work for me - and from reports I've seen it hasn't worked for others either.  The instructions I used were more recent but still quite old (Jan 2017).  However, they are Windows 10 specific and were reported by others as having worked so I gave it a shot, and indeed they worked for me.  Anyway, I've now solved the problem and it was not related to the IIS or PHP configurations.  For some reason (temporary madness?) I'd switched to referring to my test files by their filename C:\inetpub\wwwroot\...\filename.php rather than their url localhost\...\filename.php and didn't spot the error for days.  Unsurprisingly the PHP was ignored as it wasn't even being processed by IIS.  

  • Re: PHP ignored

    Mar 18, 2018 08:19 PM|lextm|LINK

    I used the steps from Microsoft and applied it to PHP 7.x on IIS 10, and did not see any issue.

    Definitely PHP on IIS needs some extra love, but currently neither IIS nor PHP communities have enough. Glad you found out the cause and fixed it on your own.

    Lex Li
    https://lextudio.com
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.