PHP script running in XAMPP and not working in IIS 8.5 - php

I have a problematic PHP script.
The script is working fine in XAMPP but I need it in IIS 8.5 and there are several errors (some of them I've managed to handle).
I've tested on same Win Server 2012 R2 and if script is in C:/Xampp/htdocs/ProjectFolder/send.php and I run it at localhost:88/ProjectFolder/send.php (XAMPP is on port 88) is working fine. If same script that is now C:/inetput/wwwroot/ProjectFolder/send.php and I run it at localhost:80/ProjectFolder/send.php (IIS is on port 80) is not working.
The script is here (PHP script)
When run the script in IIS, this is first error:
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Full screen of error here (First error in IIS)
I added 2 Handlers in IIS, at server level: Handler Mappings-->Add Module Mapping
- first handler request path is *.html and module FastCgiModule, with executable php-cgi (see image html handler ) and Request Restrictions (Mapping Invoke Handler unchecked - see image Mapping tab, Verbs all verbs - see image Verbs tab, and Access None - see image Access tab)
- second - same for php (see image - html and php Handlers added)
I run the script again (after IIS restart) and I got following error:
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Error 2 - see image Second error in IIS I cannot handle
Here I got stacked. Please advice. Thank you very much!

Related

FASTCGI process has failed frequently recently. Try the request again in a while

We have setup a Wordpress Website on IIS 10 which was working fine. But suddenly it stops working and i got this error
"FASTCGI process has failed frequently recently. Try the request again
in a while"
Restarting IIS fixed this problem.
Anybody tell me why this issue has occurred and how we can fix this ?
Thanks
Open command prompt as administrator and navigate to the php-cgi.exe
folder.
Execute any PHP file from your application to know the exact error. In my case, I created a simple phpinfo.php page and executed
following command.
C:\Program Files (x86)\PHP\v7.4.5>php-cgi.exe E:\Websites\mysite\phpinfo.php
It showed me the exact error saying 'vcruntime140.dll is not
compatible with this PHP build' & I have updated to 'Microsoft Visual C++ Redistributable for Visual Studio 2019'. You can download it from here.
Once you identified and resolved the error(point 3), you need to restart IIS server and run your website. It will work as expected.
If you're running PHP 8 turn track_errors Off in php.ini . Track_errors have been deprecated since 7.2 and can cause a fatal error in IIS
Finally, i found the solution to the issue, It is due to the low value given to "Rapid Fails PerMinute" - see above image posted by German Martin.
From Microsoft's website the default value for "Rapid Fails PerMinute" is 90 but i reduced it 10 and then the error "FASTCGI process has failed frequently recently...." started showing up.
Once i set it back to the default value of 90 , the error stopped. This is what worked for me, in my case.
You need to maximize "Instance MaxRequest" at FASTCGI Configuration. Just clic en IIS root -> FastCGI Settings, select you php-cgi.exe for WP and clic Edit. Then increise Instance MaxRequests
[IIS FastCGI Settings]

bigquery php client not working with Apache web page (Ubuntu 18.10 server)

I have a working Apache 2.4 website that works with Php 7 pages, on an Ubuntu 18.10 server.
My example is based on:
https://cloud.google.com/bigquery/docs/quickstarts/quickstart-client-libraries#client-libraries-install-php
When I run the page as me from the command line
php filex.php
bigquery works and I can see the data.
When I try and view it from the apache web server the 1st part of the page renders then there is an error and the bigquery part is missing.
Error in /var/log/apache2
PHP fatal error Uncaught Google Cloud Exception
I guessed it was a permissions issue with Apache vs my userid.
I thought Apache might be having difficulty accessing the Bigquery php client files, due to directory permissions.
However, the problem was I had not set the environment variable correctly.
I had looked here:
https://help.ubuntu.com/community/EnvironmentVariables
and set System-wide environment variables
/etc/environment
GOOGLE_APPLICATION_CREDENTIALS="/bigquery/project1/accountdetails-xxxxxxxxxxxx.json"
It was visible when logged in as userx
echo $GOOGLE_APPLICATION_CREDENTIALS
Then I came across
https://medium.com/#william.b/setting-dynamic-environmental-variables-in-apache-from-the-os-1d5c1e2e9e6c
which gave me the solution
nano /etc/apache2/envvars
I added the line to the bottom of the (mainly empty) script
export GOOGLE_APPLICATION_CREDENTIALS="/bigquery/project1/accountdetails-xxxxxxxxxxxx.json"
I restarted the server.
Now the web page works as expected.
===================
Nginx
nginx also needs to be configured to work (Ubuntu 18.10, nginx 1.14.)
from
https://medium.com/#tomahock/passing-system-environment-variables-to-php-fpm-when-using-nginx-a70045370fad
/etc/php/7.2/fpm/pool.d$
edited www.conf
uncomment
;clear_env = no
added line
env[GOOGLE_APPLICATION_CREDENTIALS] = /bigquery/project1/accountdetails-xxxxxxxxxxxx.json
restarted nginx and it worked.

Attachment size when sending email through php from an IIS 7 server

Hello I am struggling to find an answer the last couple days and I ve searched a lot but without success
I set up a webserver using IIS 7 and its running fine I ve got php mysql and I can run web applications like Epesi . I can also upload to my server using php without problems any size declared in php.ini. I have a mail web application called Roundcube (I ve tried others also) I can send and receive emails and attachments but in limited size. I ve narrowed it down to 2mb anything below 2 mb I can send and download
The errors I get from the internet explorer console within the server is
1) on creation of a new email
HTML1115: X-UA-Compatible META tag ('IE=7') ignored because document mode is already finalized.
?_task=mail&_id=1953546440546bbabb2d79a&_action=compose
2) while waiting to send a 4mb attachment (after a minute)
HTTP Error 500.0 - Internal Server Error
C:\Php\php-cgi.exe - The FastCGI process exceeded configured activity timeout
IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred. IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly. IIS was not able to process configuration for the Web site or application. The authenticated user does not have permission to use this DLL. The request is mapped to a managed handler but the .NET Extensibility Feature is not installed
Ive also tried to add to web.config
<security>
<requestFiltering allowDoubleEscaping="true">
<requestLimits>
maxAllowedContentLength=33600000
maxReceivedMessageSize=33600000
maxRequestLength="4000"
executionTimeout="45"
</requestLimits>
</requestFiltering>
</security>
but with no luck
Ok after a lot of trial and error I ve found the solution to my problem I had to increase the ActivityTimeout parameter and RequestTimeout on IIS MAnager->FastCGI Settings->(edit php application) to 90 and 270 hope this helps somebody!

HTTP Error 500.0 - Internal Server Error on wordpress

am new here - I have been having problems with this $%%$%$ IIS7.5 I have finished developing a wordpress site on my localhost using xampp - so I thought this was gonna be business as usual just copy files to remote- change config and dump sql - boy was I wrong! I think I have done everything I know to do and am still getting this annoying HTTP Error 500.0 - Internal Server Error
This is what I get each time,When I am trying to access the site:
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Detailed Error Information
Module
FastCgiModule
Notification
ExecuteRequestHandler
Handler
PHP_via_FastCGI
Error Code
0x00000000
Requested URL
http://mysite.com:80/index.php
Physical Path
E:\HostingSpaces\xxxxxxxxx\mysite.com\wwwroot\index.php
Logon Method
Anonymous
Logon User
Anonymous
Most likely causes: •IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
•IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
•IIS was not able to process configuration for the Web site or application.
•The authenticated user does not have permission to use this DLL.
•The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
Things you can try: •Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
•Check the event logs to see if any additional information was logged.
•Verify the permissions for the DLL.
•Install the .NET Extensibility feature if the request is mapped to a managed handler.
•Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
Links and More Information This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
View more information »
Microsoft Knowledge Base Articles:
•294807
Please can anyone just tell me precisely what to do,I cant take it anymore.. please help me.
So my case is hopeless - i cant be helped?
IIS server is not equal to Apache. It uses another type of configs. I think your problem in the web.config file or related to permissions. Your question isn't so subjective. You need to localize problem and describe here more detailed information. Now your question looks like this: "I have PHP application on IIS that doesn't work. I tested it on my xampp. Where is problem?". There are a lot of problems that you can have here...
I has same problem with php 5.6 on iis 6 (windows server 2012 r2)
You should ensure the VC++11 runtime is installed (for me it's Visual C++ Redistributable for Visual Studio 2012 Update 4)
It's probably because the connection string mismatch,check your connection string.
"500 - Internal server error" error message when a user tries to access your Apache or Lighttpd based dynamic php application
Generally, to solve this problem you need to take help of log files located at following location:
=> /var/log/message
=> /var/log/httpd/error_logs (/var/log/lighttpd/error_log or /var/log/httpd/error_log)
This error only occurs because of web server software. However after looking through logs you may not find many details. This problem may be caused by:
A malformed php cgi script
An invalid directive in an .htaccess or other config file
Limitation imposed by file system and server software (for example php log file size set to 10Mb)
Missing php.ini (or cannot read php.ini file)

Running PHP in IIS6

i am using IIS to run my php website and i configure IIS to work with php as its explained the following tutorial
http://www.wikihow.com/Install-PHP-5-for-IIS-6
but when i run any php page is give me the following error
You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.
i follow this https://serverfault.com/questions/251499/error-when-installing-php5-on-iis6/252149#252149
now i am getting the following error message
FastCGI Error
The FastCGI Handler was unable to process the request.
Error Details:
Could not find entry for "php" on site 67761686 in [Types] section.
Error Number: 1413 (0x80070585).
Error Description: Invalid index.
HTTP Error 500 - Server Error.
Internet Information Services (IIS)
here is my updated fcgiext.ini
[Types]
php=PHP
[PHP]
ExePath=C:\PHP\php-cgi.exe
now i am getting this error message
The FastCGI Handler was unable to process the request.
--------------------------------------------------------------------------------
Error Details:
The FastCGI process exceeded configured request timeout
Error Number: 258 (0x80070102).
Error Description: The wait operation timed out.
I hope this link would help
http://www.ardamis.com/2009/02/15/php-pages-return-a-404-error-on-iis/
Open iis.msc again, go back to the Home Directory tab, and select the “Scripts only” option >from the Execute Permissions menu. Restart the server.
The server should now be correctly processing .php files.
PHP pages return a 404 error on IIS
I was installing PHP 5 on an IIS 6 server when I ran into what turns out to be a pretty common problem. PHP appeared to be installed correctly, but browsing to any page with a .php extension returned a 404 Page Not Found error. While the steps below fixed this for me, I had to piece them together from a few different sources, and a number of other suggestions (like copying the php.ini file to C:/WINDOWS/) didn’t work and were not necessary.
Open your IIS management console at C:\WINDOWS\system32\inetsrv\iis.msc.
Drill down to your web site, right-click and select Properties.
Select the Home Directory tab, then click on the Configuration button.
Select the Mappings tab.
If you don’t see a .php extension listed, click the Add button. Browse to the PHP 5 DLL (which may be at C:\Program Files\PHP\php5isapi.dll). Type .php into the Extension field and leave everything else at the default values. Click OK. The extension and executable path will be filled out and under Verbs you should see “All”.
I should point out that I didn’t have anything listed under the ISAPI Filters tab.
Stop and restart your IIS server and browse to a .php file. (To restart your IIS server, open the IIS management console, right-click the local computer in the left pane, hover on All Tasks and choose Restart IIS.) Chances are, you’re no longer getting the 404 error, but are now seeing a 403.1 message, like:
The page cannot be displayed
You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.
Please try the following:
* Contact the Web site administrator if you believe this directory should allow execute access.
HTTP Error 403.1 – Forbidden: Execute access is denied.
Internet Information Services (IIS)
Open iis.msc again, go back to the Home Directory tab, and select the “Scripts only” option from the Execute Permissions menu. Restart the server.
The server should now be correctly processing .php files.
Take a look at my answer on Server Fault for a fairly bulletproof way to install PHP in under ten minutes:
Error When Installing PHP5 on IIS6
If you follow all of the steps in the correct order you'll have PHP up and running in no time.
Updated:
As per your comment and question update, edit your fcgiext.ini file so that it only contains the following lines:
[Types]
php=PHP
[PHP]
ExePath=C:\PHP\php-cgi.exe
Execute the following from the command prompt:
1.
cd c:\Windows\system32\inetsrv
2.
c:\Windows\system32\inetsrv>cscript fcgiconfig.js -add -section:"PHP" -extension:php -path:"c:\php\php-cgi.exe"

Categories