Apache comes back with nothing - php

I'm running Apache 2.046 with PHP 5.x and I am experiencing very odd behavior on a CodeIgniter app.
The frustrating thing is that it is not consistent.
Occasionally when I call up my app Apache returns nothing. I mean nada. But then I hit refresh and everything works as expected. Sometimes I have to hit "refreash" several times before the page will load. Other times it comes right up. When I started this post it was happening 80-90% of the time. Now I can't seem to make it happen. But it's been happening for several days so I have confidence in the next couple of page visits I will see it again.
This is on a development box that has very little traffic. When I do a PS I see several HTTP threads running - "top" reveals nothing un-expected (like a runaway process).
When I tail the apache access logs I don't even see a logged request when Apache returns blank. No Apache or PHP errors are being thrown.
I mention codeIgniter mostly because we're using the recommend .htaccess file with Mod Rewrite. So I wasn't sure if that was contributing to the issue. It also does not seem to be a problem with non-codeIgniter apps. That's hard to say with confidence since the issue is so inconsistent.
It does not seem to be client issue as we're seeing this happen from multiple client machines.
I can't tell if this is a server (hardware) issue, Apache issue or coding issue. Maybe it's a memory issue?
Any thoughts?
NEW INFORMATION:
IN the PHP log file I received this:
PHP Fatal error: fatal flex scanner internal error--end of buffer missed in /data/www/coreLib/codeIgniter/system/libraries/Hooks.php on line 226

Blank pages when using CI are usually caused by php errors with error messages suppressed.
Try re-enabling them and reloading.
error_reporting(E_ALL|E_WARNING)

If you suspect your Rewrite rules are the source of the problem, then crank mod_rewrite's logging level up and find out. Otherwise, the fact that everything works normally outside of your app makes this sound like it's a problem with your code or possibly the framework itself.

Related

CakePHP 2 Internal Server Error

Before moving on I want to mention that I have tried to look for answers in the web but in vain.
I am tasked with investigating why our CakePHP-based website is no longer working on our staging server. When loading the site at times it loads completely, but when logging a user in it takes forever to authenticate such that it produces an Internal Server Error.
Step 1: I have checked the cache directory for both persistent and models and they are clean.
Step 2: The Configure::write value for debug is already set to 2. Nothing gets written on the error.log file.
Could this have anything to do with Session data? I am trying to figure out what's going on and I have tried looking into the lib folder for Cake to see if I can edit the files in there to actually see what the website actually outputs instead of the Internal Server Error message. Which file should I edit in there? I followed this link but it seems like the core is a different version.
It turned out that there was an issue with a SAP Server connection which kept the pages on the loop until they timeout resulting into an internal server error. This is evident of the fact that the live website was working fine.
I think the best solution would be to tweak the SAP Server connection component such that it doesn't timeout requests. As much as I lack knowledge of the technology. I have disabled the call and everything worked fine at a speed of light.

CakePHP not rendering views for some controllers on live server

I have a problem, that I can't figure out.
I made an app with CakePHP that work's perfectly fine on localhost (via XAMPP), but has strange issue on live server.
There are (obviously) many controllers in my app, and the problem is - some of them are not rendering any view whatsoever! They output neither proper content, nor any error data - simply empty page (no layout either). About half of them is working fine, and the other half - not.
I have no idea what might that be, so that's why I'm here - any ideas?
This may be an old thread, but I'm replying this as a possible answer and solutions for other people who might have the same problem.
What you should do when you have this problem is to check the error log inside /app/tmp/logs. From there you can perhaps see what cause the error.
Make sure your debug is set to 2 for all error reporting to be displayed if any. The debug can be turned on in app/Config/core.php.
From the logs, you might see the error is with the maximum memory reached. For this, you'll need to fix your code and optimize it.
Please check if your URL rewriting mod_rewrite is enabled in your live server. Some server might require you to set it up yourself.
A piece of advice, always check with your error logs, it always show you what the problems are and can help you solving it easier.

Script timed out before returning headers: index.php

I'm getting this error on a magento installation in the server logs and the site is throwing a 500 internal server error.
I haven't changed anything that I think could cause this. Does anyone know where this error is coming from and what the fix is?
Is anything mentionned in the server logs? I am willing to bet you will find your true answer there.
500 is an internal fatal error, usually permission related, but other issues can also cause this, improperly configured vhosts, improperly configured .htaccess ... and many others. Check your server logs you should have more details on the error.
What were you trying to do that caused this error to appear? I get it from time to time when I do something labor intensive. For example, I'm in the process of importing around 10k products into my Magento build and got this same error message. In this particular instance, I'd be willing to be it has to do with either your Apache timeout setting or your PHP max_execution_time setting or a combination of both. It could also possibly be your PHP max_input_time setting if your like me and trying to upload/parse a giant CSV file full of products. Don't be discouraged either if you have to play with the numbers little bit to find the right combo to make things work. I have to try 3-4 times to get mine to run successfully.
A couple posts that helped me out were Script timed out before returning headers: php.fastcgi and http://www.magentocommerce.com/boards/viewthread/74021/#t213112.

What would be the cause of server closing a connection before data was sent?

I have a cakephp (1.3.10) application that seemed to work fine, but recently I get an error page that shows "No data received" in chrome. This happens randomly on various pages and in various browsers. I googled the the error and found only unrelated information.
I haven't changed any code or upgraded the framework nor did we do any updates on the server that is running the application.
What could be the cause of this?
Is this code related, if so where can I start looking to solve it in cakephp?
Any help will be greatly appreciated.
"No data received" could mean
A problem in the web server
a PHP script dying due toe a fatal error (although I think a 200 should always be emitted... depends on the server configuration I guess).
If you're using Apache, check out its error.log first. Chances are there is something enlightening in there.
If that doesn't help, you could try logging your PHP errors into a file.
If it happens randomly it might be an issue with your script running into an timeout or using too much memory. I had this issue once with wordpress as wordpress sometimes calls an internal "cronjob" on page views from time to time.

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.

Categories