CakePHP and suphp socket, connection reset by peer - php

In my Linux server's logs I have this
record nearly every 5 minutes. I
couldn't find the reason for two weeks
and I would be very happy if you can
recommend me a way to diagnose the
problem.
My hosting company insists that the problem is within my codes. I use CakePHP 2.2. But I couldn't find anything that causes this problem.
Records are inside error_log file. I use php
5.3.8 and litespeed. 2012-09-03 16:01:28.399 [INFO]
[95.7.223.91:63814-0#APVH_example.com
connection to [/tmp/lshttpd/
APVH_example.com_Suphp.sock. 781]
on request #151, confirmed, 0,
associated process: 845244, running: 0, error: Connection reset by peer!

See below URL i think solve you problem:
http://www.litespeedtech.com/support/forum/showthread.php?t=6125
Let me know if not solved your problem.
UPDATE
You able to change any PHP settings via .htaccess with the same success. If you want to turn off 'Zend Guard' add following line in .htaccess file.
Code:
php_value zend_optimizer.optimization_level = 0
see below URL:-
http://forums.zend.com/viewtopic.php?f=57&t=7063
http://www.webhostingtalk.com/showthread.php?t=947413

Related

PHP session lock issue

PHP Warning: session_start(): Unable to clear session lock record in
/var/www/efs/html/v43/Api/PortalApi/PortalApi.php on line 39
When multiple request are made simultaneously, the above issue occurs in one of our dev environment but other environments are working fine. could not resolve the reason for it.
Your problem was the user concurrency.
Setting the following ini settings (also from PHP directly) can help to mitigate this issue on a high load project
I recommend disable session.lazy_write in php.ini
You can try this too:
ini_set('memcached.sess_lock_retries', 10);
ini_set('memcached.sess_lock_wait_min', 1000);
ini_set('memcached.sess_lock_wait_max', 2000);
We fixed the issue, the problem -> in a recent code change in dev environment multiple logs was added in the code for testing configuration, the writing of multiple logs directly to efs caused the slow down

Apache in MAMP Pro 4 has stopped working, refuses to start

Have been using MAMP Pro for a fair while - version 3 primarily, upgraded to 4 a while ago.
I haven't had any unusual issues at all, but today the Apache service failed to start, telling me to check the error logs. The logs were blank unfortunately... I've made no system configuration changes, no changes to MAMP/MAMP Pro. Shut down my system yesterday, started today, it no longer works...
I've tried numerous suggestions found via Stack Overflow and Google without any success.
Even after completely uninstalling and re-installing MAMP Pro I am unable to get the service to start.
Nothing appears in the logs...
When starting it manually on the command line it comes up with a PHP related error:
$ Applications/MAMP/bin/apache2/bin/apachectl start
httpd: Syntax error on line 135 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so into server: dlopen(/Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so, 10): image not found
The confusing thing is that I don't have PHP 5.2.17 specified anywhere, at all - according to MAMP Pro it should be using PHP 7.0.12.
If I add PHP 5.2.17 to MAMP using the appropriate MAMP Pro dialogs, Apache still fails to start via the MAMP Pro interface. I can now start it manually from the command line however, but none of my virtual hosts/etc seem to be loaded.
apachectl -V tells me it's using /Applications/MAMP/conf/apache/httpd.conf, but there is nothing in that file that has any reference to any of the configs generated in /Library/Application Support/appsolute/MAMP PRO/conf
It also looks like hosts entries aren't added to /etc/hosts.
Even if I tell /Applications/MAMP/conf/apache/httpd.conf to do nothing but include /Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf (and manually add entries to /etc/hosts) it still doesn't seem to work at all...
I and my colleagues are at a complete loss, especially given it was working yesterday...
Has anyone had any issues like this?
I managed to fix the similar issue you had.
My Apache server was working fine and then following updating to 4.0.6 I experienced similar issues.
There were 2 things I did to fix the issue. I was getting the same error where it couldn't find a php file in 5.2.17. After fixing that by adding 5.2.17 to MAMP I experienced an apache error regarding user permissions.
(22)Invalid argument: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
File > Edit Template > Revert ALL Templates to Default Settings.
Save & restarted the servers and all worked finally and all my hosts had retained as well.
I had previously entered a custom line in my httpd.conf file that for countless versions had copied across fine however it looks like the folder structure had changed and so couldn't locate it causing the unusual error about User permissions. I have since re-entered the custom line with the correct structure and all working fine again.
Hope this helps.

PHP Session Start Fatal error: Can't use function return value in write | Following Extensive Troubleshooting

Fatal error: Can't use function return value in write on line 3
I've looked extensively for an answer to my specific situation with no progress. Please review what I've already tried and I've included my VPS global php.ini file. No php.ini files exist within the website root.
<?php
session_start();
?>
<!DOCTYPE html>
<html>
I have no idea how that's possible. Please check out what I've already done to try to solve the problem.
Problem originated when I was unable to pass variables to another page using
$_SESSION['$example'] variables with no luck. But I'll worry about that next.
VPS System Specs Currently (Servers/Networks Are Not My Strong Area)
Apache 3 on CentOS 6.8
Default PHP Version | 5
PHP 5 Handler | suPHP
Apache suEXEC | off
Apache Ruid2 | off
Default PHP Version (.php files) | 5
PHP 5 Handler | suPHP
Attempted Solutions
Disabled .htaccess
.htaccess contains
***suPHP_ConfigPath /***
Header append Vary User-Agent
Prior to disabling:
Removed All 301 Rewrite Rules as I've read they interfere with
sessions
Disabled Error Documents
Ensure No Whitespaces Following session_start();
Caching
Turned off all caching through WHM (that I'm aware of)
Tested both Firefox and Chrome before and after clearing history/cookies/cache/etc
Deleted CloudFlare service for this domain
Additional Information
I Don't have a php.ini file since I use a VPS (in case anyone was wondering)
I use php on almost every other page.
Here is an example of the first few lines of another page.
<?php
session_start();
$ip = $_SERVER['REMOTE_ADDR'];
//Version 1.75
The above code is just the first few lines but the page executes fine without issue. It should be noted that this is a redirect page following a PayPal payment to my website. This issue is recent and previously it has worked fine.
It should also be noted that I use session_write_close(): session_unset(); and session_destroy(); on appropriate pages to unset all $_SESSION variables and terminate sessions.
Below is a link to the php.ini file as text if that helps. The domain contained in the link is not the domain with the issue. I'm not attempting to be "shifty" about the domain with the issue, I just don't want people using the service when it's not working properly.
Global PHP INI File As Text Document
Anyone who solves this, I owe you!
-Andrew
Solved Accidentally
I solved the issues, but still don't know what was causing the Fatal Error
Fatal error: Can't use function return value in write on line 3
$_SESSION variables didn't pass between pages.
I solved both the Fatal Error issue and the $_SESSION variables problem by doing one thing. For some, this may be standard procedure, but I am self-taught and this did not occur to me. I was making changes to the PHP advanced configuration in WHM and never did not see any changes as a result.
I was banging my head against the wall for two days trying every solution I read in the forums.
Apache Server Restart
I never restarted my Apache Server during this time, both issues were resolved.
While this solution may seem rudimentary or common practice for some, it's easy to overlook. I read at least 30 different forum posts on Stack Overflow and other sites. Not one suggested an Apache Restart as a method to check.
PHP Configuration
I changed my PHP configuration as listed below and my sessions variables were passing.
session.use_cookies = 1
session.use_only_cookies = 1
session.use_trans_sid = 0
Thank you for everyone who took the time to look at this.
Sincerely, Andrew

Hosting Prestashop on iPage: Front office works, but can't log into back office, there is no error

Seems like people misunderstood my intention, I didn't mention iPage
before, but since I found my solution and it is somehow related to the
hosting provider I changed the title. Should anyone get into the same
problem as I did they would be searching this on the internet and find
this post which is exactly what I did before
I just migrated my prestashop from local host to a live server (iPage). Which means to a different domain. I've tried to follow the instruction from here Moving Prestashop Documentation. First I got problem with the backoffice ui because I used to put the installation in a folder. So I need to update the folder to '/' from my local, and I also update the domain to my own domain. After that I uploaded all my files and database to the server. And the front office works well. The backoffice login page also shows up. But when I try to login it does this:
Then it just freeze, it doesn't show any error report. Nothing.
There is no problem in the console, and the http requests seem fine too.
I've also turned on the debugging mode from the defines.inc.php
define('_PS_MODE_DEV_', true);
I've increased the max_memory from php.ini to 256M
This is so frustrating, I don't know what to do anymore.
PHP Version 5.3, MySQL Version 5.5.44, and OS Ubuntu 12
EDIT:
Wait a minute, the http request return the entire login page for some reason. But there is no error message in the source. There is just this:
<script type="text/javascript">
var img_dir = '/img/';
var more_errors = 'There are some errors.';
var one_error = 'There is an error.';
</script>
I use iPage hosting and I checked the error log from the menu CGI and Scripted Language Support > Check Error Logs. It says:
PHP Warning: Unknown: POST Content-Length of 150 bytes exceeds the
limit of 120 bytes in Unknown on line 0
Then I found out that my post_max_size parameter in php.ini is messed up. It's finally fixed now. Thanks everyone...

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.

Categories