Intermittent Magento Errors - php

We are having issues with our staging machine, which is running Magento EE 1.13.1
The problem started happening Tuesday afternoon.
At that time we updated an installed php / mysql application.
On the main magento site, the browser is redirected to the magento install page.
The problem occurs only within the Magento application and is related to sessions – when the error occurs, magento throws a fatal similar to this:
(I created a small test application to try to isolate the problem).
Fatal error: Call to a member function getCode() on a non-object in /var/www/html/app/code/core/Mage/Customer/Model/Session.php on line 71
Call Stack: 0.0002 653728
1. {main}() /var/www/html/t.php:0 0.3013 8153600
2. Mage::getSingleton() /var/www/html/t.php:20 0.3013 8153912
3. Mage::getModel() /var/www/html/app/Mage.php:477 0.3013 8153912
4. Mage_Core_Model_Config->getModelInstance() /var/www/html/app/Mage.php:463 0.3016 8302032
5. Mage_Customer_Model_Session->__construct() /var/www/html/app/code/core/Mage/Core/Model/Config.php:1348
The issue only occurs intermittently, and we can temporarily fix it by stopping and starting the httpd service.
We are running magento ee 1.13.1, php 5.3.3, and httpd 2.2.15
This is happening on a staging machine. Our production machine which has the same system and code on it, it working correctly.
We have tried to turn on/off magento compiling, caching, php apc, changed the php sessions to use the disk rather than /tmp/fs, and changed magento to use the DB for its sessions.
The site fails after several minutes.
There are no errors in the system logs.
Can someone suggest how to debug this?

This turned out to be an issue related to the libxml_disable_entity_loader() function.
The zend framework calls this function libxml_disable_entity_loader(true) and then calls it again with (false).
There is a path through our code that was leaving this set to true.
This setting's scope is not limited to the current php script, but to the current httpd process. I.e. it's sticky, and this prevents php's simplexml_load_file function from loading external files.
I came across this article:
Intermittent simplexml_load_file(): I/O warning on local Joomla site
Which led me discover that libxml_disable_entity_loader is not thread safe, and indeed 'sticky' within httpd processes.

Disable Magento compilation:
$ php -f shell/compiler.php -- disable
Compiler include path disabled
There are three ways in which this can be done:
From Magento admin
Navigate to System → Tools → Compilation page and click on Disable button. Navigate to System → Cache Management screen and use Flush Cache button.
Using SFTP, by editing at includes/config.php file
To disable compilation in Magento, edit includes/config.php. Uncomment the first line and comment out the second:
define('COMPILER_INCLUDE_PATH', dirname(FILE).DIRECTORY_SEPARATOR.'src');
define('COMPILER_COLLECT_PATH', dirname(FILE).DIRECTORY_SEPARATOR.'stat');
Using SSH shell program:
php -f shell/compiler.php -- disable
php -f shell/compiler.php -- clear

Related

FASTCGI process has failed frequently recently. Try the request again in a while

We have setup a Wordpress Website on IIS 10 which was working fine. But suddenly it stops working and i got this error
"FASTCGI process has failed frequently recently. Try the request again
in a while"
Restarting IIS fixed this problem.
Anybody tell me why this issue has occurred and how we can fix this ?
Thanks
Open command prompt as administrator and navigate to the php-cgi.exe
folder.
Execute any PHP file from your application to know the exact error. In my case, I created a simple phpinfo.php page and executed
following command.
C:\Program Files (x86)\PHP\v7.4.5>php-cgi.exe E:\Websites\mysite\phpinfo.php
It showed me the exact error saying 'vcruntime140.dll is not
compatible with this PHP build' & I have updated to 'Microsoft Visual C++ Redistributable for Visual Studio 2019'. You can download it from here.
Once you identified and resolved the error(point 3), you need to restart IIS server and run your website. It will work as expected.
If you're running PHP 8 turn track_errors Off in php.ini . Track_errors have been deprecated since 7.2 and can cause a fatal error in IIS
Finally, i found the solution to the issue, It is due to the low value given to "Rapid Fails PerMinute" - see above image posted by German Martin.
From Microsoft's website the default value for "Rapid Fails PerMinute" is 90 but i reduced it 10 and then the error "FASTCGI process has failed frequently recently...." started showing up.
Once i set it back to the default value of 90 , the error stopped. This is what worked for me, in my case.
You need to maximize "Instance MaxRequest" at FASTCGI Configuration. Just clic en IIS root -> FastCGI Settings, select you php-cgi.exe for WP and clic Edit. Then increise Instance MaxRequests
[IIS FastCGI Settings]

currently unable to handle this request. HTTP ERROR 500

I'm using Drupal 7. I get this error when I change the pagination offset. I thought it was a memory issue so I increased PHP memory limit but that didn't work.
It doesn't happen on all the pages. It happens on page 2.
The pages are created with a paginated view.
http://s***.build.us.*****.net/ko/learning-center/blog?page=2 //this doesn't work
but not on page 3
http://s***.build.us.*****.net/ko/learning-center/blog?page=3 . //this works
There is nothing useful in the apache access or the error log
When I use drush I get the following
Command watchdog-show needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. [error]
The drush command 'watchdog-show' could not be executed.
Error 500 means there was a Fatal Error in a PHP script. You could try to check Drupal Log files. It could be a bug with Drupal itself.
The issue was mysql
i had to increase the mysql config directive
mysql max_allowed_packet to something higher

Unable to install Opencart 3.0.2.0 in Linux Server

When I try to install Opencart V3.0.2.0 in Linux server, getting following error message.
Fatal error: Internal Zend error - Missing class information for in
/system/storage/vendor/twig/twig/lib/Twig/ParserInterface.php on line
31
I am not able to start my installation process. Any idea, Please help.
While this is not guaranteed to work, but since few people reported that they have been able to solve it disabling APC I would give it a try.
If you want to disable Alternative PHP Cache (APC), you can do so by modifying your PHP initialization file file.
Using your hosting account's editor (Web & Classic / cPanel / Plesk), open your website's PHP initialization file.
Note: I recommend backing up your PHP initialization file file before modifying it. You can do this by copying and renaming it in your file manager.
On a new line, type apc.enabled=0
Save your changes.

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.

Problems after moving a silverstripe website to a dev environment

We have a silverstripe website that works ok in production on a centos webserver. I am asked to make modifications to this site and have to have a working copy on our internal Ubuntu dev server. The guy that did the website is long gone and no one knows this project.
I did the move, transfered the database and changed the config files to the new settings. Now whenever I start the site I get a full page or red errors:
FATAL ERROR: call_user_func_array() expects parameter 2 to be array, null given
At line 404 in /home/user/site/sapphire/core/ViewableData.php
call_user_func_array(Array,)
line 404 of ViewableData.php
ViewableData->XML_val(current_lang,,1)
line 4 of .cache.home.user.site.mysite.templates.Layout.PageAccueil.ss
include(/home/user/site/silverstripe-cache/.cache.home.user.site.mysite.templates.Layout.PageAccueil.ss)
line 197 of SSViewer.php
SSViewer->process(PageAccueil_Controller)
line 189 of SSViewer.php
SSViewer->process(PageAccueil_Controller)
line 296 of Controller.php
Controller->defaultAction(index,Array)
line 267 of Controller.php
Controller->run(Array)
line 22 of ModelAsController.php
ModelAsController->run(Array)
line 27 of RootURLController.php
RootURLController->run(Array)
line 104 of Director.php
Director::direct()
line 160 of main.php
As far as I know nothing is "weird" on our dev server and other frameworks (zend framework or even wordpress) work perfectly.
This is not with the latest version of silverstripe but trying to update it I ran into the same errors so I'd prefer have it work before updating it.
We are using silverstripe version 2.2.2.
Any helps or pointers are welcome!
edit: I did try to load the site with /dev/build/?flush=1 and /build/?flush=1 still get the same errors on theses pages. Also the cache files should be set correctly.
1) You might want to try ?flush=all (unless you've made any changes to the database, you don't need /dev/build)
2) My first guess would be the PHP version. Do you have the same version on both the old and the dev box? SS 2.2 doesn't work well with PHP 5.3 - if I remember correctly.
Running into issues when upgrading from 2.2 to 2.4 can happen - there were some changes but they should be relatively minor. If you haven't done the ?flush=all you might still get errors from the previous version.
Or you might even want to clear out the silverstripe cache directory manually (silverstripe-cache or if that doesn't exist a few directories down in /tmp). I always do that when copying my SS files from one server to another as old cache files can lead to very weird behavior...

Categories