Cannot find save handler wincache - in Azure PHP - php

I hosted a web app on Azure using CakePHP 2.X on windows platform. I use the wincache session handler (session.save_handler = wincache). Today I have had a problem. My PHP scripts which create sessions to login to my dashboard didn't work(keeps logging me out) while I didn't change anything to this code.
Warning Error: session_start(): Cannot find save handler 'wincache' -
session startup failed in.

The PHP manual tells you to check phpinfo() to verify that wincache is installed.
http://php.net/manual/en/wincache.installation.php
Save the phpinfo.php file in the root folder of a IIS web site that uses PHP, then open a browser and make a request to http://localhost/phpinfo.php. Search within the returned web page for a section called wincache. If the extension is enabled, then the phpinfo output will list the configuration settings provided by the WinCache.
The error message means what it's saying. It's not there.
My PHP scripts which create sessions to login to my dashboard didn't work(keeps logging me out) while I didn't change anything to this code.
This is not a coding problem.
You need to check your wincache installation and maybe re-install it.

Related

Unable to install Opencart 3.0.2.0 in Linux Server

When I try to install Opencart V3.0.2.0 in Linux server, getting following error message.
Fatal error: Internal Zend error - Missing class information for in
/system/storage/vendor/twig/twig/lib/Twig/ParserInterface.php on line
31
I am not able to start my installation process. Any idea, Please help.
While this is not guaranteed to work, but since few people reported that they have been able to solve it disabling APC I would give it a try.
If you want to disable Alternative PHP Cache (APC), you can do so by modifying your PHP initialization file file.
Using your hosting account's editor (Web & Classic / cPanel / Plesk), open your website's PHP initialization file.
Note: I recommend backing up your PHP initialization file file before modifying it. You can do this by copying and renaming it in your file manager.
On a new line, type apc.enabled=0
Save your changes.

Blank pages after installing PHP on IIS

I am attempting to install PHP onto Windows Server 2008 R2. I have followed the instructions here but when I try to load phpinfo.php I get a blank page.
There are no errors in the Event Viewer.
The server is used to host multiple other Asp.Net websites but I am using PHP so that I can install MediaWiki.
UPDATE:
When trying to load simple HTML (with no PHP) it also loads as blank. The fix for this seems to be to enable "Static Content" in the "Turn Windows features On/Off" manager - but this is already in place.
This happened to me as well just running the handy dandy php installer microsoft has on their site using their Web Platform Installer and it turned out in the php.ini file by default short_open_tag by default is off so my code
<?
print("hello world!");
?>
would not work because it was expecting
<?php
print("hello world!");
?>
.... so yea ... just go and change that if this is your problem too!
If copying over an old Wordpress installation from an old server - make sure you copy ALL the files. Oops... <embarassed>
A blank page is also possible when there is an PHP error and error reporting is of. Try to run the script below to see what happens.
<html>
<body>
Hello HTML
<?php
error_reporting(E_ALL);
echo "Hello PHP";
?>
</body>
</html>
You could also try to see if a normal HTML page with PHP extentions runs fine. Perhaps your server is setup to disallow PHP extention.
You have to configure fastCGI for each PHP website, more details you can find here - Best Practices for Configuring FastCGI and PHP
So I found the solution after hours of randomly trying things. I removed and re-added the Static Content role in Windows - still same result. Then I edited the Error Pages feature of the website in IIS to say return Detailed Error Messages. At this point PHP started to complain about the timezone so I set to "Europe\London" - for this to take effect you need to restart IIS.
After that it worked, phpinfo now loads!
I had this issue; at "turn Windows features on or off", I enabled:
HTTP Errors
Server-Side Includes
Directory Browsing
Windows Authentication
I also set these options in C:\Program Files (x86)\PHP\v5.3\php.ini:
display_errors = On
display_startup_errors = On
After that, a 401 Unauthorized error was displayed. I added 'Everyone' and 'Users' groups to the folder to fix.

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"

Is HTTP Authentication possible with PHP on IIS FastCGI?

I've just migrated from PHP 5.2.3 using php5isapi.dll to PHP 5.3.0 using FastCGI and php-cgi.exe. On this site I have hooks for windows/ntlm/http authentication doing something like this:
if(empty($_SERVER["REMOTE_USER"]))
{
header("HTTP/1.1 401 Unauthorized");
exit;
}
$winuser = $_Server["REMOTE_USER"];
//parse $winuser to make sure it is on my domain, and can login to the site.
//set a cookie specifying that this user is logged in
//redirect to site.
This worked just great under PHP 5.2.3 with isapi. Now that I've moved to FastCGI on IIS6, it is broken. It works for me, but I have administrator on the server. Those without administrator (most people) see some variant of the following:
FastCGI Error
The FastCGI Handler was unable to process the request.
________________________________________
Error Details:
• The FastCGI process exited unexpectedly
• Error Number: -1073741819 (0xc0000005).
• Error Description: Unknown Error
HTTP Error 500 - Server Error.
Internet Information Services (IIS)
I have tried plowing through documentation and log files, but can't seem to make any headway. I don't actually want the remote username to be used to access my .php files, I just want to grab the name and match to my database. The anon user should still be the one doing the actual php execution.
Any leads?
Some progress, but no real solution yet.
Following the advice here was useful: FastCGI Docs
Especially the Security Recommendations section. This got my errors out of FASTCGI 500 and into the php error log.
It appears that PHP/IIS/FastCGI wants to access the session directory (mine is C:\PHP\Session) via whatever user attempts to authenticate instead of the anon user.
Setting "Modify" permissions on that folder to "All Users" allows the site to work as desired. However, I'm then wondering how big of a security hole I'm creating by doing this...

PHP, MySQL on IIS - MySQL not being loaded when serving pages

I have, as best as I can manage, set up IIS (6.0), PHP (5.2.8) and MySQL (5.1.30) on Windows Server 2003, with all the involved mucking about (I think) in IIS and PHP to get things talking to each other.
PHP does work - however, I cannot use the mysql or mysqli libraries from a PHP page.
Fatal error: Class 'mysqli' not found in...
Fatal error: Call to undefined function mysql_connect() in...
Information relating to MySQL or MySQLi does not appear when using phpinfo() in a PHP page.
However, when I invoke PHP from the command line, such as
> php -r phpinfo()
Information relating to MySQL and MySQLi does appear in the output from that.
Restarting IIS or the OS does not produce further effect. I have only one php.ini file, in the PHP root directory.
Do I need to connect MySQL to IIS somehow as well, or is there another problem?
The php.ini file used for command-line usage of PHP may be different from the php.ini used by the web server. You should get phpinfo() information by putting a small PHP script under your web server's document space:
<?php
phpinfo();
?>
Open this PHP script by using your browser to request that PHP script via an URL to your web server. That will tell you what the web server thinks is your PHP configuration.
Also remember that you need to restart the web server for edits to php.ini to take effect. It only reads the php.ini when the web server starts.
There are numerous places the php.ini file that your IIS instance is using might live. See http://php.net/manual/en/configuration.php or http://www.iis-aid.com/articles/how_to_guides/where_php_ini_is_loaded_from for details.
Look at the output of phpinfo() when viewed in your browser, and look for the item "Loaded Configuration File".

Categories