Blank pages after installing PHP on IIS - php

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.

Related

As I am using the local hosting of MAMP but " There has been a critical error on this website" this is error is coming. What should I do?

As I am using the local hosting of MAMPbut " There has been a critical error on this website" this is error is coming. What should I do?
Diagnostic steps worth giving a shot, follow from top to bottom order;
Is MAMP really running with Web server (and additionally the database server)?
Do you see the default MAMP index/home screen?
Put a simple HELLO WORLD HTML document to your project root and check if you can see it on browser
Put a simple HELLO WORLD PHP script to your project root and check if you can see it on browser
At this point, if everything above went well, it is definitely an issue with your actual PHP script, check the PHP error log file
Put an INFO.PHP PHP script at your project root and check you have all the required extensions available for your PHP project
Check if database connection is working (if required)
At this point, I cannot imagine what else would go wrong, try PHP debugger (xDebug needs to be installed with MAMP and your PHP editor may need a configuration for this) with break points and step into each line of your PHP code with debugger.

cURL installed on Windows... but how to get it to work with PHP code?

Background:
I'm trying to get tweets from a specified username using PHP and OAuth. This example seems very useful. My problem is that my code doesn't return from the $feed = curl_init(); line near the bottom. There are no errors displayed, I only know that it stops because my debug statements after that line are not executed.
I didn't have cURL installed so I installed it on my Windows machine (using this example). It still doesn't produce any errors, it just leaves and never comes back.
Question:
How do I access cURL from my PHP program where I want to use it?
You need to download the windows php zipped manual installer from windows.php.net, the manual zip comes with all the extensions. Once php has been installed, enable the CURL extensions.. and any other extension that you need in the php.ini file. Copy the php-production.ini to %systemroot% directory and rename it to php.ini.
Hope that helps !!!

SocialEngine 4 - Blank Sign Up & Sign In pages... :-/

Wondering if someone can help...
I am running PHP 5.3.6, on Windows Server 2008 R2, with IIS 7.5 & Helicon APE (Apache module for .htaccess files)
I have a legitimate serial number from socialengine.net (although my support tickets have expired.)
I downloaded 4.1.8p1 from "My Account" and unzipped directly into the web root (no need to FTP as I'm working directly on the host server)
I went through the install with no probs, everything went as expected.
When I goto "Sign In" or "Sign Up" I get nothing but a blank page. As far as I know all folders that require the 755 equivalent are set. I can upload & activate plugins with no probs etc.
Development mode reveals nothing, and even with all error reporting on in php.ini I still don't get any error... FirePHP doesn't report anything either (except the norm debug info)
I currently have no 3rd party plugins installed, it is a brand new installation, yet the 2 pages just will not work :( :(
Anyone got any ideas on how I can find out what the problem is??
Domain is http://dance-network.net
Many thanks in advance!
Proof of purchase
A blank page usually means a PHP script error. We suggest going through the code of the page that is not showing up and trying to print errors with:
ini_set('display_errors', 'on');
error_reporting(E_ALL);
However some servers (such as the ones that run on Parallels Plesk) have error reporting disabled. We suggest enabling error reporting or going through line by line with print statements to see where the error might be occurring.

How to debug using WAMP?

I just installed WAMP on Windows XP. I have a simple PHP file that is crashing. I ran it from command line using php test.php.
What is the best way to debug php files? How do I display debugging info?
I looked at php.ini and it includes display_errors = On. Does this do anything?
I tried turning on XDebug from the PHP WAMP menu. This doesn't seem to do anything, besides restarting the server. Do I need to use this? How?
Thanks.
You can look at the log at c:/wamp/logs/php_error.log. If you are not sure whether your PHP log is being redirected here, check your php.ini file and search for a line like this:
;error_log = "c:/wamp/logs/php_error.log"
You may want to remove the comment on this line.
As much as i know about PHP and WAMP.I don't think there is any special debugging option available in this.for the debugging you need to print the answer using echo and exit function wherever in your code you feel the error may posible. The other option is, you need to use software which provide debugging facility such as eclipse with php.
I am using WAMPSERVER 2.4 on Windows 8 pro. I was using WAMP on localhost.
It appears that in my version of WAMP, the php.ini file had appeared as:
;error_log = "Z:/wamp/logs/php_error.log"
When in actuality,for me get the function error_log() to work properly, I wanted it to appear as :
error_log = "Z:/wamp/logs/php_error.log"

PHP5: calling external functions, and logging errors

I'm painfully new to PHP, and was trying to set up phpBB on my local site. I have a stock debian install of apache2 and php5. The phpBB installer ran fine, connected to the database and created all its tables with no problem. But when I tried to open the login page, I got a 0-byte response.
A little digging showed that it was never making it past the call to mysql_pconnect(). The php binary just quits without error or message. Nothing at all. I tried running the following code:
<?php
$id = #mysql_pconnect('localhost','myusername', 'mypassword', true);
print "id=".$id."\n";
?>
and the "id=" string never prints. It just does nothing. I don't know where to look to see what error happened, or what is going on at all. All i've installed is "mysql" using pear... perhaps I'm missing something else?
This has got to be a path problem somewhere. The mysql extension is built nicely at
/usr/lib/php5/20060613+lfs/mysql.so
Answer:
jishi: informed me that the "#" operator suppresses output, including error messages (#echo off, anyone?)
tomhaigh: extensions must be explicitly enabled in php.ini file. After adding the line "extension=mysql.so" to php.ini, the following code runs fine:
% cat d.php
<?php
ini_set('display_errors', true);
error_reporting(E_ALL | E_NOTICE);
$id = mysql_pconnect('localhost','myusername', 'mypassword', true);
print "id=".$id."\n";
?>
% php -c /etc/php5/apache2/php.ini d.php
id=Resource id #4
JOY!
Just noted that you're using a # in front of mysql_pconnect(). That suppresses all errors, which in this case is a pretty bad idea. Remove that and you would probably see the output.
Otherwise:
Check your php.ini, should be in /etc/php5/apache2/php.ini for debian.
Check for a line called display_errors, set that to true if you want error-output in your browser (not recommended for a production-system, but is useful during debugging and development).
Specify log_errors on for apache to log your errors to apaches error logfile, which by default in debian would be (unless other error-file is specified for the phpBB-site):
/var/log/apache2/error.log
try doing this:
<?php
ini_set('display_errors', true);
error_reporting(E_ALL | E_NOTICE);
$id = mysql_pconnect('localhost','myusername', 'mypassword', true);
print "id=".$id."\n";
?>
and see what the response is
edit
From your comment it looks like the mysql module is not installed or enabled. You could have a look in your php.ini file and see if there is a line like
extension=mysql.so
If it is commented with a semi-colon, try removing it and restarting apache
Remove the "#" That is muting the error messages that mysql_pconnect is throwing.
Documentation
I sometimes have PHP going down a 'black hole' when it finds a function that it can't find.
Can you verify that the mysql extension is installed correctly?
You can do this by creating a php page like this:
<?php
phpinfo();
?>
Saving it in your webroot, and then accessing it. It should contain all the information about what your server is currently running in terms of PHP modules.
I think you have no mysql extensions installed for your PHP. Since PHP5 I think it is a PECL extension.
If you are working on windows, there should be a pecl.bat or something like this in your php directory. Just go there via console and enter
pecl download mysql
Then everything should work as expected.

Categories