PHP reloads in stead of outputting HTML - php

I have a PHP script that's called when submitting the order form (removed). The script does some basic verifications and uses an external API (sends a GET request with file_get_contents and stream_context_create) to register/update user info.
The problem is that sometimes it works right, but most of the times it reloads the page that called it. The page is hosted on my LAMP server (removed). If I host it locally, using the PHP build-in server, it does seem to work always.
I don't have a clue what can cause the webpage to reload instead of executing the echo statements.
The script worked right last Friday, but now it doesn't. Today I've updated PHP, but - as I expected - nothing has changed.
Obviously there isn't anything in the error_log.

There's probably a bug with the latest FastCGI handler. With any other handler (CGI, suPHP, DSO) the script works correctly.

Related

net:err_connection_reset after loading php file completely

I have a quite simple php page (PHP 5.5.35 on CentOS 5.11) that queries a MySQL database. The resulting page shows completely, including the footer I include as a final instruction, so the PHP script runs entirely without error.
Almost every images and js libraries are loaded. However, there are two elements that are never loaded, an image and a jquery library. Each time and with any browser, those elements generate a (in Chrome, for instance) :
Failed to load ressource : net::ERR_CONNECTION_RESET
For testing purpose, I tried to delete those element from the page, ultimately, it is the favicon that can't be loaded. So it seems not to be those elements in particular. The connection seems to be reseted at some point between the PHP script completion and the page loading… and I don't have the beginning of any clue where I should start the troubleshoot.
Some other informations :
Apache logs don't log anything !
The other pages of the site works well
The site works without any problem on my local machine (Mac OS X, PHP 5.5.35 too)
Once the page is loaded, if I click any link on it, it shows a "Connection reseted" error page.
Does anybody have a clue, anything about where to start my search ? Thanks in advance, I am starting to desperate.
It happened that after searching everywhere, the cause was simply that I was handling a lot of parameters through GET – too many of them. I changed the code for using POST and everything worked miraculously… Hope it may help someone, sometime !

404 The requested URL / was not found on this server

I have a form that collects data and may take several hours to complete since it has an editor where users can add creative elements. If the form is submitted after an hour or so, the site redirects to a 404 Not Found, the URL was not found on this server. I tested this using a very simple form processing script that prints out POST data and still got the error. This seems to only happen on our linux server. I have a WAMP local server running the same script and the POST data sends through fine, no matter how long the form is idle for. Any clues as to what I can try change on the Apache config or PHP side. Thanks

PHP session not working properly on server

This is a weird problem and I really don't know how to explain it so please bear with me. The thing is I have a php project which has been coded from scratch(no template engine or frameworks), and it works fine on localhost, but as soon as I upload it on server, for some odd reason, the pages and session data seem to arrive from a cache. For example if I try to delete a value(by submitting a form), the page loads and still shows the value, if I then hit Ctrl+F5(force reload on FF), it loads correctly showing( or rather not showing) the deleted record.
Can this happen due to any server-side settings?
Try and clear all sessions from your browser. I have experienced something similar, it could be sessions set by your local host on the browser that is conflicting with it.
Try and set cache for php files to 0 using htaccess.

PHP error, no data received

I keep getting this error:
No data received
Unable to load the webpage because the server sent no data.
Here are some suggestions:
Reload this webpage later.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
I know it's part of my script, but I don't know which part. It divides certain text into a few different files, and those files are being created, but it's also supposed to zip them, but it's not getting to that part, so I have a vague idea of the general area the problem is occurring. I know this entire question is lacking detail, but I'm hoping that someone who has more experience with PHP and who may have seen the error before would be able to tell me what's happening.
http://gyazo.com/12ba55613011a115bb7507040f4d3ddf
EDIT: It works on Firefox... How can it be different between browsers if it's server-side script?
Restart apache and mysql
service httpd restart
service mysqld restart
Hopefully this answer helps someone.
It's a Chrome thing: http://www.google.com/support/forum/p/Chrome/thread?tid=7d50c093bd4f8f6c&hl=en
I don't know if you've already solved this, if it's a different problem causing the same symptoms or whatever, but yesterday I noticed this same error on my development machine, running Apache+PHP+MySQL under Linux, when accessing my local phpMyAdmin:
http://localhost/phpMyAdmin
It was running fine until that day, and I realized that by the same time I changed some settings related to sessions in my php.ini.
The problem was caused by having session.save_handler set to user instead of files. So I switched back to
session.save_handler = files
and voilà... everything is working fine again.
Also be sure to have set the proper session.save_path. In my case, and probably in most Linux systems,
session.save_path = "/tmp"
Be sure to set the proper permissions to that directory, too. Mine is chmod'ed to 777.
A little late to the draw here, but I received this error while working on a local copy of a php project (on Chrome), and although Firefox loaded some parts of the pages, it was still throwing similar errors.
The really weird part was that if I commented out includes or a few functions it would load partially.
I got around it by restarting the local server. I was using MAMP. You can tell for sure that this is the issue if you're running MAMP by going to the home page - it'll likely throw the same error.
tail -f /opt/local/apache2/logs/error_log
(or wherever is your apache2 install..)
... Will likely help you to spot where the problem lies in your PHP script. At least it did for me when facing the same problem (No data received, whatever the browser).
I was getting this issue intermittently in Chrome. For me, reloading the page would get a successful (non-empty) response, but it would sometimes take up to 3 or 4 reloads of the page. To handle this, I added the $.when(), .done(), and .fail() jQuery functions to my AJAX request. If the request fell into the .fail() function, I ran the location.reload(); js command to get the page to reload. Otherwise, I called a function that did the rest of my page loading in the .done() function.
This has the potential to create an infinite loop with the page never receiving a successful AJAX response and continuing to reload forever. So only try out this method if this issue is intermittent. If you are unable to get a successful AJAX response at all, then this method will not work for you.

HTTP 500 Internal Server Error?

I am working in a php web site and my web server application is IIS on Windows Server 2003.
I added a web form that is needed to be saved and sent by email.
There are four files used to achieve that:-
file1.php - to get the user inputs
through the form insisde it. file2.php
- to recieve the form data then save it in database using odbc and send
some of them by email file3.js - to
validate form elements file4.css - to
change the design and style of the web
page
I faced a strange error message which has not any reference to specific option or setting that I can change to solve the problem.
what I get is as the following:-
HTTP 500 Internal Server Error
The website cannot display the page
HTTP 500
Most likely causes:
•The website is under maintenance.
•The website has a programming error.
What you can try:
Refresh the page.
Go back to the previous page.
More information
Since at the moment there isn't much details in your question, I suggest you can do this: 1) try to print a "hello" in your PHP file and see if it works first, and if it does, then try the first few lines of your program, and print out something and see if it works or not. In other words, reduce to the simplest and see if it works or not. Then build on it gradually.
read IIS log
find IIS log in http://portal.smartertools.com/KB/a154/where-are-my-iis-log-files-stored.aspx

Categories