500 Internal Server Error using SilverStripe - php

I have a problem with my SilverStripe site after a server upgrade to PHP 5.6. My web host upgraded the server from PHP 5.3 to PHP 5.6 and now a 500 server error occurs on every page.
The message from SilverStripe is:
Sorry, there was a problem with handling your request.
In the server error log files there are no error entries.
In the server access log you can see the 500 error:
ERROR:
[09/Mar/2016:11:12:07 +0100] "GET /Security/login?BackURL=%2Fadmin HTTP/1.1" 500 11398 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36"
Next entry in file is OK:
[09/Mar/2016:11:12:08 +0100] "GET /themes/ustheme/css/us.style.css HTTP/1.1" 304 0 "http://www.example.com/Security/login?BackURL=%2Fadmin" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36"
How do I debug and fix this problem?

When switching PHP-version, your cache needs to be flushed. Switch your site to dev-mode to flush without having to logon. Or just delete your cache-directory (or create a root-directory named silverstripe-cache.)

First try to flush the site cache as suggested by Simon Erkelens.
Sometimes flushing the cache will not work. This may be because the SilverStripe version cannot handle the PHP version.
If our site is on a server with cPanel some web hosts allow us to select the PHP version through cPanel. This feature is not on every server with cPanel but hopefully this becomes more common.
Select PHP version may be found in the cPanel software panel:
On the PHP selector screen there is a PHP version select box allowing us to select a PHP version. To change PHP version select an option from the PHP version select box and press the Set as current button. Flush the site cache to see if the site now works.
I recommend using the newest version of PHP that will work with the SilverStripe site so that it is as secure and stable as possible.

run below command to get rid off from internal server error
/dev/build
if your site is
http://silverdemo.com
then run command like below
http://silverdemo.com/dev/build
it will rebuild the database and models

Related

Why POST request can be changed to GET on the way from NGINX to PHP

I have next very strange situation:
POST request to the server.
In nginx logs I see something like that: IP-ADDRESS - ce5c8fb7-0a40-4c4e-9b8e-779cae54d4ad-1522849217932 [11/Jun/2018:11:37:38 +0000] "POST /unsubscribe HTTP/1.1" 400 69 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"
So, nginx is seeing that request like POST
But if I do echo $_SERVER['REQUEST_METHOD'], I will have "GET" as output.
This happens only for one endpoint "/unsubscribe". For all other endpoints POST request works fine.
There no rules in configs related to "unsubscribe" word.
I did try a lot of variants, tests, turn off cache where is possible. But still same behavior. Probably someone has idea what would be good to try in that situation or someone had same problems before?
P.S.
On there server I have Ubuntu + Nginix + PHP 7.0. Not sure, but probably it can be related to PHP version somehow, because some time ago we upgraded from 5.6 to 7.0

Opencart Internal Server Error

I have a problem with opencarted payment modules. I use version 3.0.0.0 and all modules are working fine except the ones that are in payment section. I get an Internal Server Error which at logs says:
GET /admin/index.php?route=extension/extension/payment&user_token=LpWyMlFDTymqDs4I6Q1iUwUV6sI3VCet HTTP/1.0 http://eshop.capsport.gr/admin/index.php?route=marketplace/extension&user_token=LpWyMlFDTymqDs4I6Q1iUwUV6sI3VCet Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 303 Apache access
2017-07-12 10:27:38 Warning 94.70.255.140 mod_fcgid: stderr: PHP Fatal error: Can't use method return value in write context in /var/www/vhosts/paokbcstore.gr/eshop.capsport.gr/admin/controller/extension/payment/pp_express.php on line 1282, referer: http://eshop.capsport.gr/admin/index.php?route=marketplace/extension&user_token=LpWyMlFDTymqDs4I6Q1iUwUV6sI3VCet Apache error
2017-07-12 10:28:34 Warning RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
Any possible solutions?
I am using openCart v. 3.0.1.0
and Plesk for web hosting
I was having a similar 500 internal server error when I proccessing the checkout step 6.
My mistake was that, I was imported from an old version of openCart the data of the old Database to the new one.. But, in this senario the new version of openCart has some new table's columns as a saw carefully (such as inside table oc_order: tracking, payment_custom_field and so on). So, I have created these colums again, and now the step 6 from the checkout finally works again..
Iniside Plesk there is a choice saying: error-logs (or you can find it something like: log file, logs files e.t.c.). Inside this file I saw the mistake that says:
"mod_fcgid: stderr: PHP Fatal error: Uncaught exception 'Exception' with message 'Error: Unknown column 'tracking' in 'field list'" that's how I found the issue to my problem..
there are lots of things you could try though:
You could try some of the above...maybe could help you:
clear all caches
disable all extensions and inable them one by one, in order to see which one of them causes the problem..
download the same openCart version that you are using, and upload the checkout core files again.. maybe some of those files broke you code..(although this problem coming from extensions - modules)
check PHP version. Some users in openCart forum said that the problem solved by using the version of PHP 7.
see pp_express what are the needs of this payment proccess (link to github that my help you or maybe ask there: https://github.com/opencart/opencart/blob/master/upload/catalog/controller/extension/payment/pp_express.php)

Apache2 internal server error not being logged

I'm doing some web development with the Laravel framework, and I have my jQuery set up so that it sends a request on click of a button to a PHP file, which then returns the result back to my jQuery.
However, every time I click this button I get an Internal Server Error. This is not the problem; rather the error is that my Apache error log does not make any mention of this 500 Internal Server Error. In fact, it doesn't really log anything except for [notice] caught SIGTERM, shutting down and [notice] Apache/2.2.22 (Debian) PHP/5.4.4-14+deb7u12 configured -- resuming normal operations. All that being said, my access.log shows the Internal Server Error happening:
"POST /testing/public/apps/devicecheckout-checkoutdevices HTTP/1.1" 500 833 "http://xxx.xxx.xxx.xxx/testing/public/apps/devicecheckout-checkoutdevices" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36"
In my php.ini file, I have error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT and log_errors = On.
How can I solve this problem?
Your script causes the apache process with PHP module to crash, as such it does not attempt to write anything to the logs and the parent process is the one logging all it knows: its child process caught SIGTERM.
I solved it by putting die("here") to different places to pinpoint where the crash happens, going deeper into code and all used libraries and frameworks. Then use your jugement to figure out what to do.
One thing I noticed that causes this a lot, is to print_r() a complex object with circular references.

Sever responding with a 500 error and error code 204 off and on, while development server works perfectly

I have searched and searched to find an answer to this strange issue on Google App Engine (PHP). My application generates the error below, but only say once out of 5 or 6 calls. There is absolutely no error on the development server. I have disabled APC caching and have tried things like changing version numbers.
The error shows on the log as follows:
2014-05-14 11:53:30.270 /mapi/index.php?action=login&params%5Blogin%5D=kumar76&params%5Bpassword%5D=kumar123&_=Submit 500 121ms 0kb Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14 module=default version=1-0-test
24.55.15.118 - - [14/May/2014:09:53:30 -0700] "GET /mapi/index.php?action=login&params%5Blogin%5D=kumar76&params%5Bpassword%5D=kumar123&_=Submit HTTP/1.1" 500 0 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "simplycrowmapi.appspot.com" ms=121 cpu_ms=0 exit_code=204 app_engine_release=1.9.4 instance=00c61b117c1279e8c136be007edf2c17b5bfd1
W 2014-05-14 11:53:30.270
A problem was encountered with the process that handled this request, causing it to exit.
This is likely to cause a new process to be used for the next request to your application.
(Error code 204)
my php.ini:
google_app_engine.enable_functions = "php_sapi_name, gc_enabled, phpinfo"
allow_url_include = "1"
upload_max_filesize = 8M
apc.cache_by_default = "0"
apc.enabled = "0"
I also got this error using CodeIgniter v2.1 and v3 on app engine and got this error as well.
It happens when using $autoload['libraries'] = array('database');
Then after a few random page refreshes this error pops up.
After changing the following in database.php:
'pconnect' => TRUE,
into
'pconnect' => FALSE,
This errors is gone in my application.
Now both version 2.1 and 3 are working for me.
Maybe there is a similar setting in the framework or code you're using.
I had the exact same problem, also resolved by using non-persistent connections. According to App Engine's Cloud SQL documentation https://developers.google.com/appengine/docs/php/cloud-sql/#PHP_Managing_connections it can only serve 12 concurrent connections, which is probably less than the number of front-end PHP processes.
For PDO, that's
PDO::ATTR_PERSISTENT => false

Zend2 on submit POST gets 500 error and blank page

I have two servers each running a modified version of ZF2 Skeleton Application.
Server1:8080 - REST API that just returns JSON
Server2:8081 - Web client serving our customer
I am getting the famed 'White Screen of Death' in Server 2.
Visit a user's webpage via the route /%s - %s being their username, everything looks fine
User is presented with a status text box and submit button
I click submit with some text, and get the White Screen
I recently added an ability to POST a status update to the page.
server2:80 127.0.0.1 - - [03/Apr/2014:21:52:27 -0700] "POST /myusername HTTP/1.1" 500 357 "server1:8081/hwy9nightkid" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/33.0.1750.152 Chrome/33.0.1750.152 Safari/537.36"
Notice the log file is citing port 80.. not sure why.. but just to double check I looked at my endpoint.. it's working fine for everything else (user's profile data displays)
zf2-server2/module/Api/src/Api/Client/ApiClient.php: protected static $endpointHost = 'http://server2.local:8080';
This site was working great until I added this module's ability to POST data to Server2.. any ideas on how to debug this the Zend way? I'm new so I may just start littering the system with logging information to trace where it's truly stuck, maybe grab an IDE like PHPStorm if that would help.
I know for a fact the POST is received by the Server 1.. my guess is something happened processing that data.. and a 500 error was returned instead, but shouldn't that give me a nice looking error page???
Update & progress with 500 Error
In order to debug, I used an application called Postman
www.getpostman.com
Thanks to this utility for Chrome, I create a simple POST to my service and found an error message was being returned wrapped in JSON.
Error 500 : Table 'tablename' doesn't exist in db.
I'm going to look up how to properly handle errors / json responses that are unexpected.. and how to properly re-route my client to an error page.
Update TL;DR - Seems my Server2 Web Client is failing to either Log this error AND OR display a 500 error page.

Categories