PHP returns blank with legit code - php

I've copy pasted the get facebook messages script from this website:
http://cappelendesign.no/2010/04/tutorial-facebook-rss-feed-parser-in-pure-php/
Works like a charm on two test hosts but I can't determine why it doesn't on the main..
PHP Version is 5.3.15
And SimpleXML is enabled.
I've tryed different retrieve PHP scripts from whom I know they work. They all return blank.
Any ideas on what this problem could be?
Gr.
Kevin

This usually happens when you have an error but the php is defined not to show errors.
try to add:
error_reporting(E_ALL);
ini_set('display_errors', 1);
at the begin of your code to see the errors.

Related

Can't find php error log, can I set it on runtime to record errors in a different file?

So I'm coding php on a friends site and the hosting provider has hid the php error log somewhere we haven't been able to find. It would be very useful in debugging the code, is there some code I can add to the top of the script to record the errors in a file I pick?
Edit: I've tried Dagon's suggestion with a test file with the following code:
ini_set("log_errors","1");
error_reporting(E_ALL);
ini_set("error_log", "/actual_file_path/Errors.txt");
print_r(file_get_contents("/actual_file_path/Errors.txt"));
fake_function();
The file path is correct because print_r(file_get_contents("/actual_file_path/Errors.txt")); is printing the text I added to the file. When the page dies form calling fake_function() nothing is recorded in Errors.txt. Really strange.

AMPPS not displaying errors?

I looked PHP.ini files but error mode is on there?
But when there is error in my code I cannot see php showing error??
I use local host called AMPPS.
And whenever there is error i see blank page like if i use:
require('something.php');
There is a blank page instead of showing fatal error or warnings.
I use CodeCanyon script. Can script change the error showing mode?
How can I display all there error even if it is small on as I am on development mode.
Can script change the error showing mode?
Yes, it can. For starters you can set this in your PHP file—before code like require('something.php');—to force errors to show:
error_reporting(E_ALL);
ini_set('display_errors', 1);
But that said, if errors are not displayed at all, check your Apache logs in your setup. Unclear on where in AMPPS the logs would be stored—or what your host system running AMPPS is—but there should be a log in there somewhere.

php script appears as a blank screen

I'm trying to run a php script on my website through my file manager but it just shows a white blank screen. I ran a couple of test php scripts on my file manager and runs well. The php script that runs a blank screen has been tested offline with WAMP and works fine, The php script involves connecting to a database which it does, uses simple_html_dom for web scraping and inserting to a database. Can someone please help. Surely if it works offline it should work online no error messages are showing
Turn on your error reporting first :
error_reporting(E_ALL);
It might be occurring because you have switched off the error_reporting and the connection is not being successful.
Check if your database connection credentials are correct.
If the problem still exists, refer to this page :
PHP Blank Screen - Solutions
Make your error reporting on by
error_reporting(E_ALL);
Also, please check php's error log file.
Every page crash is printed there.
Generally, in php folders of WAMP, XAMPP.
For XAMPP in Windows, the file location is:
xampp\php\logs\php_error_log

php, ajax error reporting is not working

i have this file and on a click event it calls a php function through $.post{}
i have used alert(data) to recognized errors. But unfortunately its not allerting anything except it shows an error on firebug console with relevant url "Internal server error 500" and then i tried to access the code through browser pasting the full url, I have put error_reporting(E_ALL);
ini_set("display_errors", 1); , but shows a blank page. I'm lost here no idea how to solve this without any errors displaying.. Help much appreciated.
p.s in php info error reporting is off. i tried htaccess on my subfolder without no luck either.
Make sure of the following:
error_reporting(E_ALL) is right after <?php tag
There is indeed a PHP error - try to deliberately make one. Maybe the error is elsewhere, not your PHP but the .htaccess file (since you're getting 500), or maybe it's a logical error.

PHP website does not work, and nothing logged in the error log

I have a problem with PHP. There is an error that I have never encountered before. The home.php, which is the main page of my site, cannot be viewed. And there is nothing in error log. After there is an inclusion of a php page (a class that is a part of my API). Till that line the holl HTML (javascript and css inclusions) are echoed from php and successfully rendered in browser, but after the php kind of stops suddenly. When I delete that line(php page inclusion line), website works, but before, this inclusion didn't make any problem for me. I removed the code parts which after them I encountered this problem, but nothing works.
I am using Apache2, PHP5 with Ubuntu 11.10.
Any help will be appreciated, thanks in advance.
My first hints would be to check the following:
In your script set ini_set('display_errors', '1'); and error_reporting(E_ALL); to display all errors.
Turn on the php error log and check it for errors.
run php -l home.php on the command line to check your php file for syntax errors.
Check Apache's error log, sometimes error messages go there.
If nothing helps use a debbugger like XDebug to see where the script terminates, or alternative insert statements like die("here"); and move them around in your code, to see which parts of your scripts are passed.
Greetings and good luck.

Categories