I am developing a web application in Laravel 5, I basically fetch data from database in controller method and pass it the the view which is then shown in a table. When i request that page, sometime complete data is not shown. Like it misses couple of rows randomly, it happens randomly every once in a while, sometime plain html is shown in browser and sometime the script as well, but when i refresh the page it shows complete information on the page properly.
What possible reason can be behind this?
Using the php artisan serve command often cause this problem. In a recent past, I encountered the same.
You can get rid of this by setting up your application on a virtual host. I'm using Laragon for virtual hosts and the application is working absolutely fine now.
Related
DESCRIPTION: I have a normal HTML website (say, https://example.com) and it has been hosted on Hostinger. Last week, I purchased a PHP script from CodeCanyon. I had put this application on this URL https://example.com/VideoDownloader. The website is running perfectly, but, I'm facing problem with this PHP script.
For the first time, if you visit this URL, it'll redirect you to install.php page. Once you install the script (which takes less than 2 mins), you can immediately start using the application by visiting the same URL. Now, it'll not redirect you to install.php.
PROBLEM: The script works perfectly for 1-2 days. The problem is after 2 days, the application breaks and it starts redirecting you to install.php page again. And, again you have to install it to make it work. This cycle keeps on repeating.
There is nothing wrong with the code and it is running perfectly in my localhost. The version of PHP in localhost is the same as that on my Hostinger server.
WHAT I HAVE TRIED: I tested the script in my localhost and it is running perfectly without breaking. Searching on the internet was not much helpful. However, I got the hint that the issue may be related to the MySQL database to upper/lower case characters.
Please, guide me on this.
Website file structure:
Without errors or other information do not think many will / can help you. I suggest checking your error / access logs first.
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 !
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.
I'm testing my app to make sure in production it handles errors properly, and one such test is if the mysql or redis services it uses are down.
I'm looking for it to show the 500 error page, but currently its showing a blank page.
I haven't tested this under Laravel 4 yet but the app I'm working on is using Laravel 3 and for production the errors config is set to not show detail and to log instead.
I'd rather it go to the 500 page so at least uses know there's an error in this rare case it may be down.
Does anyone know if this is possible? or is this is what happens in Laravel 4?
[Edit 1]
On investigation, it looks like the MySQL connection doesn't occur until my first db call, which makes and so my first db call is in the start.php file. Now i can wrap this call in a try/catch BUT at this point i can't return Response::error('500'); as its not in a route or controller, and Event::fire(500) doesn't work at this stage either as it needs to read other files after such as the routes file which also has db calls.
So what im now looking for is a way to call the 500 error page directly from the start.php file and just stop the app running at this point, before the routes.php file or any other files are even loaded in.
Any ideas?
This is what happens in Laravel 4, in my limited experience with it anyway.
Look at the server log for a probably answer.
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.