My CI app has been working well so far.
However I noticed that when a longer SQL query is requested (for example on the home page where around 50 blog posts are shown) there is a serious problem.
Sometimes the page loads fine. Unpredictably, as I reload that same page - with no change in content - the browser keeps hanging until I get back an Apache 500 error. This happens on multiple browsers.
CI error logs show nothing. PHP error logs show nothing.
I've noticed this is not an issue with smaller queries (ie, 20 posts), but am unsure if it has anything to do with the problem, after all, it does download 50 posts on some attempts.
I know this is hard to explain in detail, but if anyone could give me any pointers on how to debug I'd be very grateful. Glad to add any info.
The app is running on a Plesk 9 RHEL server, PHP 5.3.8, MySQL 5.5.17, CI 2.1.0.
php error log file
-rw-rw-r-- 1 apache apache 0 May 19 10:46 php_errors.log
php.ini info
error_log /var/log/php_errors.log /var/log/php_errors.log
log_errors On On
Use the sparks Debug-Toolbar here: http://getsparks.org/packages/Debug-Toolbar/versions/HEAD/show
Then watch the times that your queries take to load, view your memory etc. Slowly increase your post count from 20 to 30 to 50 to 100 etc until the error occurs - and see if something sticks out.
I suspect a PHP timeout is occuring, either because you have the timeout value configured to low (should be around 230), or your query is really poorly written and inefficient, causing the server to take too long to return the result with a larger query.
Related
I have a new IIS 10 / Server 2019 server, which uses a SMB file share for app data. My problem is, for PHP sites there is a delay of about 2 minutes and 15 seconds for a simple "hello world" website to start. Even stranger, it does it on all sites with PHP 7.x, but not on 5.x unless it's a more complicated site like Mediawiki. It also only does it when loaded over the fileshare, which is otherwise quick to access. Once loaded the first time it runs quickly for about 3 min until whatever loaded process has to reload from scratch again. Using the error log, I can see that PHP loads the ini instantly and will complain about formatting errors and such right away, but the first line of a php page does not load until the last second. PHP xdebug also doesn't seem to note anything until the last second of loading.
It certainly seems like something is trying to resolve and timing out, but using //192.168.1.x doesn't work any better than //fileshare. I've poured through the php.ini looking for a culprit but can't find it. Any help is greatly appreciated!
The main settings I've messed with are the ones below with different combinations and ways of writing the path.
cgi.force_redirect = 0
cgi.fix_pathinfo = 1
fastcgi.impersonate = 1
fastcgi.logging = 0
track_errors = Off
soap.wsdl_cache_dir = C:\inetpub\php_temp
error_log = "C:\inetpub\php_errors\php_error73.txt"
upload_tmp_dir = C:\inetpub\php_temp
sys_temp_dir = C:\inetpub\php_temp
session.save_path = C:\inetpub\php_temp
Managed to trace it down to two odd culprits.
The main time out issue was:
user_ini.filename =
By default it's commented out in php.ini, so removing the semi colon disabled that feature which must have had trouble searching for ini files on the file share.
Second issue on 5.x seemed to be related to having the old mysql plugin enabled. Leaving it enabled didn't seem to matter on local disk, but having it enabled caused issues on the file share. I'm using mysqli in code, so no problem disabling it for me.
On a server of mine, running Ubuntu 14.04.5 with Apache 2.4.23 and php-fpm 7.0.11, I'm getting random 403 errors.
I say "random" because the page I see in logs with 403 are running fine when I try them. Also, I experienced directly (I mean by visiting a site on the server with my browser) that I got a 403 error, then retried (just refreshing) and I got a 200.
The server is running some websites (about a dozen), with various kind of solutions (a couple of Wordpress, a few old spaghetti php apps, mostly modern apps based on Symfony framework).
I'd also be happy if someone can point me to some way to increase the verbosity of some logs, to try resolving this issue on myself. Currently I see the 403 errors in the apache logs of vhosts.
Is `mod_evasive' enabled ? To see please try
ls /etc/apache2/mods-enabled/ and if you see mod-evasive.load the apache module mod-evasive is enabled.
The goal of this module is to deny access with a 403 request when too many request come from the same pc(ip) or or when a lot of pages were viewed in a short amount of time. The ip is somewhat blocked for a certain period of time.
Sometimes refreshing the page can fix the problem, but it is still annoying.
What you can do is
1)to disable it with
a2dismod mod-evasive and
service apache2 restart
or
2)Find the httpd.conf file and modify the different parameters. Increase the thresholds for mod_evasive to be less sensitive
modify the default value by something like:
<IfModule mod_dosevasive.c>
DOSHashTableSize 3097
DOSPageCount 5
DOSSiteCount 100
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 2
</IfModule>
MODEV_DOSPageCount
This is the threshhold for the number of requests for the same page (or URI) per page interval. Once the threshhold for that interval has been exceeded, the IP address of the client will be added to the blocking list.
MODEV_DOSPageInterval
The interval for the page count threshhold; defaults to 1 second intervals.
etc... You can change them
All the parameters and best solutions are explained here
https://wiki.atomicorp.com/wiki/index.php/Mod_evasive
I have one website in Yii framework.
It was working fine till few days but since few days sometimes I am getting
500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.
This error occurs when there is more data load in page.
If I am on simple page where there is no need to get more data in page then it is working fine but when I am uploading or downloading or need more time to get data then mostly I am getting this error.
I have Windows server.
Can anybody guide me how can i solve this error?
You should check the webserver and php error logs, most probably is configuration problem
memory_limit
max_execution_time
upload_max_filesize
check http://php.net/manual/en/ini.core.php
Facing a squid error. This is the error message we are getting.
Read Error
'The system returned: (104) connection reset by peer.
Our web product is hosted on godaddy. The whole website is working completely alright except this one page on which we are facing the error.
the page times out exactly after the 15 secs.
On testing the same page on localhost it works completely alright, but the same page when tested on server is timed out.
Can anybody suggest us an solution?
Breaking our heads from past many hours.
thanks in advance.
link for the page we are getting the error : http://silicongem.com/rhea/testrd.php
for authentication you can use username: demo
password: demo1
Snapshot:
Well my servers were not upto the mark. I had to change the server. Since, old servers were not able to compute too many operations in few seconds.
Some time a bad Squid config can also cause this. Please check if you have correct memory config defined. These are few important settings to keep your Squid healthy -
max_stale 24 hour
cache_mem 1500 MB
memory_replacement_policy lru
cache_replacement_policy lru
cache_swap_low 93
cache_swap_high 97
positive_dns_ttl 24 hours
negative_dns_ttl 1 minute
quick_abort_min 0 KB
quick_abort_max 0 KB
You may find documentation here by replacing each directive at the end -
http://www.squid-cache.org/Doc/config/cache_swap_low/
I am using the Codeigniter framework in a project - I have a tool which reads an array and sends out over 10,000 emails using the SwiftMailer Email framework.
One form which I have once submitted is supposed to send out each individual email, however it doesnt sent out all of them as after a period of time I get the following error:
404 Page Not FoundThe page you requested was not found. - 500.shtml
The page itself doesnt actually redirect anywhere else so cannot understand why it would be saying this - anyone have any ideas?
Thanks
It looks like you're actually ending up with a 500 error, but when CI tries to display the custom error page for a 500 error (500.shtml), it can't find it, and so throws a 404 instead. Check your logs for the cause of the 500 error.
It'll be a custom error page, probably set up on the web server itself. If it's an Apache server, check the httpd config and remove any ErrorDocument directives you don't want so you can see the actual error.
As Tom said, if this is happening after a significant delay, you're likely getting a timeout. The length of timeouts can be increased from the PHP end using set_time_limit() or the php.ini setting max_execution_time. However in general if you have a long-running task it is much better to run it in a background process than try to shoehorn it into an HTTP request.