Server/websites very slow loading - php

I have a server for 5 month now with Debian 7 Wheezy and cpanel virtual/webmin installed. Never had any problems except a week ago.
I did not do any changes on the server. The problem is as follows:
The first time when I checked the websites a week ago i received the DAtabase error 500 connection on every website i visited on the server.
I then checked status of server and MySQL was down. So i put this up and installed all updates in virtualmin and then restarted. All was working fine, until 10 minutes later. The website became very slow.
When I checked error log i got the following:
[warn] [client ] mod_fcgid: read data timeout in 40 seconds []
[error] [client ] Premature end of script headers: xmlrpc.php
I then changed FcgidConnectTimeout=600 to 9999 for /etc/apache2/mods-enabled/cfgid.conf. Again i did a restart and all was working fast again. ten minutes later same issue. Sites are loading very very slow.Sometimes more then a couple of minutes.
I checked error log again and i found the following error:
[warn] [client ] mod_fcgid: can't apply process slot for /home/fcgi-bin/

Related

ISPConfig 3 - mod_fcgid: error reading data from FastCGI server

I recently restored a server backup and now I get the following error trying to access any website (including the ISPConfig admin interface):
mod_fcgid: error reading data from FastCGI server
End of script output before headers: index.php
I have tried to set
opcache.enable = 0
in php.ini which seems to have worked for some, but I still get the same results.
I am using ISPCOnfig 3 on Centos 7 with php 5.4.16 and Apache/2.4.6

Access Telegram-CLI using php

I want to access the Telegram-CLI using PHP.
I'm compiled Telegram-CLI and loged in to my account, and its works like a charm.
I installed LAMP ([in Linux], Apache, MySQL, PHP) and i tested them works.
I even installed these [following] PHP packages one-by-one using "Composer" and tested the examples but i couldnt make them run...
Also it seems their forum are abandoned to get my questions answer.
php-client for telegram-cli
A wrapper for Telegram-CLI
PHP Wrapper and Drupal module using Telegram CLI
Could somebody tell me how to make one of them work in simple way.
All steps of building Telegram-cli, loging in for first time and run it as deamon has beed completed.
For Example:
This project has been installed on php project root dir using "Composer".
Example.php file has been moved to web server root directory.
But also unning it cause a 500 Internal server error.
The error line is:
$telegram = new \Zyberspace\Telegram\Cli\Client('unix:///tmp/tg.sck');
notices:
The file has been checked and is already there.
And the telegram-cli is running as a daemon on root user.
I added a telegramd group and telegramd user assigned to that group.
I detacted that php commands running under apache user account.
I changed the apache user group to telegramd.
But again nothing...
So, Please help me
Edit:
I changed the httpd.conf user and group parameters to run at the same (telegramd) account
User telegramd
Group telegramd
And i have restarted the apache and checked the username by
exec('whoami');
The Apache is running under "telegramd" user account.
But nothing again..
Edit 2:
error_log file:
[Wed Feb 10 11:02:04.251133 2016] [:error] [pid 1172] [client 10.0.1.24:49168] PHP Warning: stream_socket_client(): unable to connect to unix:///tmp/tg.sck (No such file or directory) in /var/www/html/vendor/zyberspace/telegram-cli-client/lib/Zyberspace/Telegram/Cli/RawClient.php on line 48
[Wed Feb 10 11:02:04.251332 2016] [:error] [pid 1172] [client 10.0.1.24:49168] PHP Fatal error: Uncaught exception 'Zyberspace\Telegram\Cli\ClientException' with message 'Could not connect to socket "unix:///tmp/tg.sck"' in /var/www/html/vendor/zyberspace/telegram-cli-client/lib/Zyberspace/Telegram/Cli/RawClient.php:51\nStack trace:\n#0 /var/www/html/example.php(10): Zyberspace\Telegram\Cli\RawClient->__construct('unix:///tmp/tg....')\n#1 {main}\n thrown in /var/www/html/vendor/zyberspace/telegram-cli-client/lib/Zyberspace/Telegram/Cli/RawClient.php on line 51

Accidentally turn on SSL / HTTPS for phpmyadmin

I'm running Ubuntu 14.04.2 LTS, Apache 2.4.7, mysql 14.14, phpinfo.php
I was trying to reconfigure phpMyAdmin and I'm no longer sure what I actually did, because now all attempts to access the page result in a redirect to https, which doesn't work because my Apache server isn't configured to run SSL. I go to http://MYDOMAIN/phpmyadmin and it turns it into https://MYDOMAIN/phpmyadmin/?collation_connection=utf8_general_ci&SID which just has an SSL connection error.
I've tried uninstalling and reinstalling phpMyAdmin several times with no success.
If I go to http://MYDOMAIN/phpmyadmin/setup I get a blank screen but this line shows up in my weblogs:
[Tue Mar 24 05:09:10.518308 2015] [:error] [pid 8888] [client 50.161.45.55:49637] PHP Fatal error: Call to undefined function PMA_generate_common_url() in /usr/share/phpmyadmin/libraries/common.inc.php on line 352
I've tried creating and uncreating /usr/share/phpmyadmin/config/config.inc.php but it seems to have no effect.
Any ideas what I might have done and how I can revert back? mysql is still running fine and I'd rather not have to reinstall that.
Find phpmydmin's config.inc.php and change the line as follows:
$cfg['ForceSSL'] = false;

AWS Elastic Beanstalk - PHP script fails to execute after deploying new version

I am using AWS Elastic Beanstalk for PHP which manage 1 EC2 linux server with Apache web server.
When deploying a different version (zip file with all my php scripts) through the management console i sometimes run into a weird situation.
In some cases, even if i am deploying a version with exactly the same scripts which all worked before, some of them suddenly aren't working. When deploying another version again (still same scripts, same content), suddenly everything is working as normal.
Example of a problematic service :
<?php
// dynamically loads needed classes
function __autoload($class_name) {
include $class_name . '.php';
}
$response = new Response();
$response->data = array('platform_version' => Configuration::PLATFORM_VERSION);
die(json_encode($response));
?>
Normally, this script returns a json object. After changing nothing and deploying a version this scripts returns nothing. Is there a way to find if an error occurred?
BTW, i can see a call to the service in the application_access_log of Apache with return status 200.
EDIT:
After changing the error level on the web server i started to see interesting information in the application_error_log :
*[Mon Nov 05 17:19:44 2012] [error] [client 10.210.159.209] PHP Fatal error: require_once() [function.require-once]: Cannot redeclare class response in /var/www/html/InstallerLog.php on line 12
[Mon Nov 05 17:19:44 2012] [error] [client 10.210.159.209] PHP Stack trace:
[Mon Nov 05 17:19:44 2012] [error] [client 10.210.159.209] PHP 1. {main}() /var/www/html/InstallerLog.php:0*
Why am i getting this error?
I am using :
require_once 'Response.php';
In my script so this kind of error should not occur for my knowledge...
OK. So eventually it was pretty basic.
The error occurred because the class name i was using, "Response", was already in use in other place (not in my code, maybe in the SDK or something like that).
After changing the name to something less generic the error didn't happen again.
Just for play safe i have also added :
if(!class_exists('MyNewResponse'))
before creating the class.

Connection reset by peer after 500 seconds

I have this strange problem when i run an import cronjob in made.
It processes a 1.5GB XML file containing about 400.000 products. The script works fine and would take multiple hours to complete, but after about 500/600 seconds i get the following email from the cron-deamon.
PHP Warning: file_get_contents(http://test.nl/admin/cron_index.php?route=module/EZImport&cron): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error
in /home/test.nl/public_html/admin/controller/tool/EZImport_cron.php on line 8
Warning:
file_get_contents(http://test.nl/admin/cron_index.php?route=module/EZImport&cron):
failed to open stream: HTTP request failed! HTTP/1.1 500 Internal
Server Error in
/home/test.nl/public_html/admin/controller/tool/EZImport_cron.php
on line 8 bool(false)
My apache error-logs say:
[Fri Nov 02 09:43:39 2012] [warn] [client 176.9..174] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Fri Nov 02 09:43:39 2012] [error] [client 176.9..174] Premature end of script headers: cron_index.php
This is the cron file called by the cronjob
require_once('../../config.php');
$opts = array('http' =>
array('timeout' => 36000)
);
$context = stream_context_create($opts);
$url = HTTP_SERVER."cron_index.php?route=module/cronMod&cron";
$result = file_get_contents($url, false, $context);
var_dump($result);
die();
I need to run this cron via file_get_contents
Environment:
DEBIAN,
OpenCart
The max execution time in webmin (php config) is set to 36000 seconds.
processes a 1.5GB XML file
Erk, this is a bit silly - you need a minimum of 2 passes to verify the document is well formed and there's lot's of scope for bad things to happen.
The max execution time in webmin (php config) is set to 36000 seconds
For which end?
You also need to configure the timeout for the webserver and every other component in the chain between client and server, however trying to transfer a 1.5Gb file over HTTP is just silly - you might get it to work - but it's not the right way to solve the problem. Break it up into more manageable chunks.
Try using set_time_limit(0) in the script or change the time limit in php.ini

Categories