CakePHP not rendering views for some controllers on live server - php

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.

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.

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.

Smartformer Component on joomla 1.5 intermittent error

I'm currently using smartformer component for joomla 1.5 and have been facing a weird situation from this component. Here is the scenario:
I have created a survey form using the component as the user logs in to the site they would see the welcome page and there is a button named "Take Survey" so when they click on this button they could start answering the questions. Most of the time the form is going to show successfully, but for intermittent reasons it would fail to display. What your just going to see on your browser is really blank I tried to call this code on the file that will render the form:
ini_set('display_errors', 1);
but no errors are being displayed.
I'm very confused about this, it's very difficult to troubleshoot cause no messages are being displayed of what was actually happening.
Is there anyone who was able to encounter the same error before?
Any possible solutions would be greatly appreciated. :)
Surely your best bet here is your error logs. Through your hosting control panel (cpanel, plesk or similar) you should be able to download your server's error log. From this you should be able to see what the exact error is that the server is experiencing. Your control panel may also have a 'last 100 errors' listing - but this is less useful unless you go there directly after experiencing the error yourself.
Displaying errors in the browser on a live site isn't the best way of debugging as you basically disclose potentially harmful information to people who have no use even for the useful portion of the error message.
If you really must turn on error display in Joomla please do so through the /administrator/ area's global configuration options. But remember to quickly turn them back off again. I stress this procedure is only useful if you can reproduce the error reliably within a few clicks.
Without looking at your error logs here are my 'top 3' guesses as to the likely cause of an intermittent error:
You are probably hitting a memory limit and the server is killing the process. Raise the memory_limit in php.ini if your hosting setup allows this.
A timeout - if the page isn't finished within x seconds your server kills the script process. Generally this gives a script headers not finished message.
Some other resource limit is being hit - CPU usage, database queries.
But - in the end your error logs are your friend.
We've already identified the one that is causing the problem. The smartformer fails to fully load the whole form most especially the part that will redirect going to the survey form to which the users should be filling up so our resolution is to just create a separate custom module that will redirect to survey form. We don't really know what is really happening on the process but as I said it seldomly happens and we need a resolution more earlier than tracing the bug due to a hectic deadline, but I really appreciate those who provided me their ideas. There are really lots of things that I'm learning from you guys hope you'll keep on supporting forums like this. ;)
Thanks,
Chris
You need to increase the memory_limit in php.ini. Memory_limit must be more that 64M for Smartformer.

Apache comes back with nothing

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.

Categories