Have you ever had your server knocked down by hight load?
This is a very simple tip that you can improve for your needs.
The normal situation when it happend is the server load go up and stop to response. It's normal when the website is being attacked by lots of bots or bad users like a DDOS. We know the problem is so many connection but we normally can't do nothing in this moment.
In order to prevent the server down, I found a very simple way in application side.
I use this code in my application controller and return status 503 to the requester.
# return status 503 when the load is so high
$load = sys_getloadavg();
if ($load[0] > 50) {
header('HTTP/1.1 503 Too busy, try again later');
die('Server too busy. Please try again later.');
}
If you are using the getDistance method provided by Geogrphical Template in Doctrine and got this error:
UPDATE: IT WAS FIXED, CHECK IT OUT AT http://www.doctrine-project.org/jira/browse/DC-524
500 | Internal Server Error | Doctrine_Connection_Pgsql_Exception
SQLSTATE[22003]: Numeric value out of range: 7 ERROR: input is out of range
You probably have the same problem that I got today..
I'm using NUMERIC on column type with precision 10, but the problem is not in the column latitude and longitude, it´s on calculation.
To resolve this problem I made a casting inside of ACOS function calculation, I tested it only in postgresql.
My DQL used to get all hotels around 3 kilometers of hotel id 189646
On symfony is a good idea to use the referer to costomize some messages, like this one below.
in template, you have to make a condition:
<?php if( $sf_request->getReferer() != '' ): ?>
The page <?php echo $sf_request->getParameter('page'); ?> was changed.
<?php else: ?>
I'm running plesk 9.0.1 and I configured my app on a subdomain, I did these steps to configure the app:
1) remove all default directories of domain
rm -rf /var/www/vhosts/example.com.br/subdomains/myapp/*
2) I put my files on document_root, like this
/var/www/vhosts/example.com.br/subdomains/myapp/conf,
/var/www/vhosts/example.com.br/subdomains/myapp/symfony
I was creating a new project and I wanted to create on model Client a field called birthday as DATE field. I noticed that the admin generator form created a limited year's select to 5 forward and backward. I'm too change the format of field of mm/dd/yyyy to dd/mm/yyyy. How can I did it?
You need to override the formClass, like this:
class ClientForm extends BaseClientForm
{