APACHE server run slow suddenly - php

I'm using Apache for my localhost, bot now it's slowed down without any error suddenly, each time I start load a page it takes more than 1 minute , I do see any uncommon error in the error log , and my PHP code is also run perfectly without error.
I had tried several solution like adding localhost, enablemmap on off, setting only IPv4 but and non of it helping.
Is that anything more i can try to fix this ?

I fixed it by re-installing Apache server.

Related

500 Internal Server Error After DNS Changes

I changed my DNS to my new server on iPage. My previous server was AWS and now I got this error message:
I used to access to my site from here http://matchmakinginstitute.ipage.com/ but now is not working either.
So both links:
http://matchmakinginstitute.ipage.com/
http://matchmakinginstitute.com/
Are showing me the same error. I checked my error log file and I have only 1 line:
1479164063:
/hermes/bosnaweb03a/b2364/ipg.matchmakinginstitute/ssv3_payload_extractor-aU0H89Pshc.php
startup
Does somebody know what else can I do to fix this issue?
Thanks
Keep in mind DNS changes can take up to 48 hours to take effect.
If it's still not working after 48 hours i would suggest reverting the DNS changes and try again.
https://godaddy.com/help/what-factors-affect-dns-propagation-time-1746
Your page seems to be working fine now, did waiting do the trick ?

how to fix -ERR_CONTENT_DECODING_FAILED in Wamp

I have Drupal7 site. It was running fine with no issues. But suddenly I am getting
This site can’t be reached
The webpage at http://localhost:8080/mysite/ might be temporarily down or it may have moved permanently to a new web address.
ERR_CONTENT_DECODING_FAILED
Its not the issue in any specific browser, but same error with any browser.
Checked links:-
Error 330 (net::ERR_CONTENT_DECODING_FAILED):
http://stefantsov.com/fixing-err_content_decoding_failed-in-apachephp/
https://www.howtoforge.com/firefox-content-encoding-error-google-chrome-error-330-net-err_content_decoding_failed-unknown-error
I tried reinstall, reimport database etc things but same error persists.
Its been now about 24hours getting this error.
What should I do now to get rid of this error & re-run my site smoothly.
Other Info
Drupal 7
wamp 2.5
php5.5.12
Any help highly appreciated.
I was facing the same issues in xampp server on localhost.
I spend almost 2-3 hours to figure it out so i am sharing the solution to save someone else time. Below is the solution that work for me.
1) Edit the php.ini files of xampp/wampp
2) Enable the extension zlib.output_compression = On If it will be Off
3) Un-comment the code from ;zlib.output_compression = On to zlib.output_compression = On in commented using ";"
Error 330 seems to be linked to when a site's HTTP response headers claim that the content is gzip encoded, but it isn’t. Are you using gzip compression?
Try turning it on, or off via the htaccess file, or check here for other alternative ways to enable it. https://varvy.com/pagespeed/enable-compression.html

file_get_contents() security issue on local domain only with CentOS security settings

I know there are a hundred posts about file_get_contents() on SO but nothing seems to solve my problem:
Everything was working fine fifteen minutes ago, until I ran some security stuff via SSH. I added some iptables rules and I file_get_contents and I ran service proftpd restart and a few installs/uninstalls which seems to have disabled PHP's fopen() functions somehow.
In php.ini, I have: allow_url_fopen = on & extension=php_openssl.dll on
I'm trying a simple test: (this file loads fine via the browser)
echo file_get_contents("https://www.this-domain.com/logo.gif");
//...failed to open stream:HTTP request failed! HTTP/1.1 404 Not Found...
//However both of the following work absolutely fine:
echo file_get_contents("https://www.google.com/");
echo file_get_contents("/home/user/domains/this-domain.com/private_html/media/logospin.gif");
I cannot change the file_get_contents() code (to cURL or otherwise) - this is a server settings issue. Possibly something to do with the firewall. Can someone please suggest a fix?
The problem was in fact a DNS issue. file_get_contents() was bizarrely routing through our backup nameservers (ns3 & ns4) for some reason, while browsers were routing through the primary nameservers (ns1 & ns2). Unlike the primaries, the backups point to a different server, which does not yet have identical files - hence the unusual 404.
I had set up these backup nameservers only a few hours before tinkering with the firewall etc and by the time they propagated, it looked very much like the ssh commands had taken file_get_contents() offline.
Thanks for all the comments guys - very much appreciated.

Drupal + Nginx + Php-cgi : 502 Bad Gateway error

We are running Drupal 5.x on Nginx with php-fastcgi.
Things were working fine for a while. All of a sudden, we (users) are running into 502 Bad Gateway error.
Restarting PHP-cgi, nginx.. rebooting machine etc did not help.
Did anyone else run into this type of issue? What are the possible suspects?
Today I was getting “502 Bad Gateway” on a CI project , after digging into the problem I found out it is a problem of nginx fastcgi buffers , here is how to fix it :
open /etc/nginx/nginx.conf
add the following lines into http section :
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
502 errors are usually caused when PHP freaks out for some reason. The first thing you should do is check all of your logfiles. That includes system stuff in /var/log/ and the nginx logs.
If you haven't made any recent changes and the problem just started happening for no apparent reason, PHP may be running out of memory. I know when it happens as an Apache module it gives a blank screen--wouldn't be surprised if a 502 error happened under nginx and the FastCGI interface. That's easy to fix by putting ini_set('memory_limit', '256M') into your index.php and see if that fixes the problem.
Also, can you load stand alone PHP files that don't involve Drupal? Put putting <?php phpinfo(); ?> into a file called info.php and try hitting that and see what happens.
Good luck!
I got this error as well and I eventually disable all modules (non-core) and enable them one by one to see what caused the error.
Here's a easy way to disable all non-core modules.
If the problem just started.. Read above.. if the server is new just setup, try this command to see if it's even listening on it's port
netstat -lpn | grep ":9000"
If course you could have setup fast-cgi to work on a different port, so just replace the port 9000 in that statement with what ever port you're looking for.. If nothing continues to show up, likely nothing is listening on that port and you need to fix that problem first.
If you have firePHP disable it.
Big headers causes problems while nginx comunication with php
Usually when I have come across this it has been a fatal error in PHP somewhere. Have a look at your PHP-cgi log to see if it is in there. There should be something in the nginx log like this: 104: Connection reset by peer. Depending on your setup this (sorry, link dead) might help but if you're using php-fpm it won't.
increase your memory limit and it will be fixed. ini_set('memory_limit', '256M');
It is because you probably upgraded to PHP 5.5 and therefore you now are using opcode cache which you may have enabled twice. That is check php.ini and also opcache.ini.

pg_connect crashes my php script

I'm trying to run a PHP script which has pg_connect($connection_string) and it just crashes my PHP script. I'm running it off of xampp on my computer, here are some facts:
If I put exit("test"); immediately above the pg_connect statement, it successfully displays the word "test" and terminates the script, so I know that my installation of xampp is working.
Using phpinfo() I can see that the postgresql extension is indeed loaded.
I can connect to the database server from pgadmin, so it's not a firewall issue or anything like that.
If I remove this exit statement, the pg_connect statement just hangs. There is no warning displayed or logged, and it never even gets past the function call. I even have:
$db_crm = pg_connect($connection_str);
if (!$db_crm) die("connection failed");
And "connection failed" is never even displayed. My browser just shows "this page cannot be displayed",after timing out.
What in the world could be causing this?
It's doubtful that the call is crashing PHP. More likely is that for some reason, the call is hanging for some reason and PHP's max execution time is being exceeded. You can try extending the time limit before making the pg_connect() call to see if it eventually comes back with something.
Check the Apache error logs
Check the php error logs
Make sure you have logging enabled in your Postgres config file.
In your config, set
log_min_error_statement (DEBUG5)
to grab everything possible.
Check the postgres error logs
Here it is guys:
I have no reason why, but adding sslmode=disable to the end of my connection string made it work. What reason would it have to crash? I am on a windows machine and phpinfo() says OpenSSL is enabled..
This sounds really stupid, but is your server running under SSL? I've had problems where a server will try to authenticate to ssl and hang indefinitely, trying to connect to a non-existent port.
sslmode=disable did the trick for me. To disable ssl in postgres-config ( ssl = false ) also worked.
For me, the Apache logs revealed that PHP was not finding the pg_connect() function, even though php-postgresql was installed. Restarting Apache fixed this, i.e.
sudo service httpd restart

Categories