Laravel public folder shows 500 Internal Server Error - php

I have recently installed laravel through softaculous in CPanel. After the installation, when I tried to open the website, it shows 500 Internal Server Error. Actually, I am a beginner in Laravel. The following errors I got from error_log.
[08-Aug-2020 12:56:03 UTC] PHP Fatal error: Declaration of Carbon\Translator::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale) in /home/hugar/public_html/jityo.com/vendor/nesbot/carbon/src/Carbon/Translator.php on line 18
[08-Aug-2020 12:56:03 UTC] PHP Fatal error: Uncaught ErrorException: Declaration of Illuminate\Http\Response::setContent($content) should be compatible with Symfony\Component\HttpFoundation\Response::setContent(?string $content) in /home/hugar/public_html/jityo.com/vendor/laravel/framework/src/Illuminate/Http/Response.php:14
Every assistance will be appreciated!.

Check the server php version and the php version in composer.json file of laravel framework, if it's not a match then you have to change the server php version and it will work like a charm. this happened with me as well.

The php version(7.1) on the server was lesser than php version in composer.json(7.2).
The problem fixed by upgrading the php version(7.4) on the server.

Related

PHPOffice: PHP Fatal error: Interface 'Psr\SimpleCache\CacheInterface' not found

I have custom WordPress plugin where I giving option for admins to download export of survey. The plugin using package phpoffice
I have test hosting with PHP 7.3 where export goes well and the production hosting is on PHP 7.3.3 (before it was PHP 7.4) where the exactly same problem does not work.
I'm expecting to resolve this error and make the option for download exports working..
I've tried searching for google but I didn't find solution exactly for my problem.
I tried this stuffs:
Upgrade memory_limit from 256MB to 512MB
Tried to downgrade production hosting PHP version from 7.4 to 7.3.3
When production hosting PHP version was 7.4 it gived this error in PHP error log:
[22-Dec-2022 08:45:24 UTC] PHP Fatal error: Uncaught Error: Interface 'Psr\SimpleCache\CacheInterface' not found in /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php:14
Stack trace:
#0 /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/composer/ClassLoader.php(571): include()
#1 /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/www/doc/www.di...')
#2 [internal function]: Composer\Autoload\ClassLoader->loadClass('PhpOffice\\PhpSp...')
#3 /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Settings.php(164): spl_autoload_call('PhpOffice\\PhpSp...')
#4 /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/CellsFactory.php(19): PhpOffice\PhpSpreadsheet\Settings::getCache()
#5 /www/doc/www.digitalniagora.cz/www/wp-content/ in /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php on line 14
After I downgraded the PHP version to 7.3.3 (because I haven't option to downgrade to PHP 7.3) I getting just this error:
[27-Dec-2022 15:43:23 UTC] PHP Fatal error: Interface 'Psr\SimpleCache\CacheInterface' not found in /www/doc/www.digitalniagora.cz/www/wp-content/plugins/agora_survey/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php on line 14
EDIT 29.12.2022:
I tried update PHP version on test hosting to the same version as production hosting is but on test version it working well and production version code does not work.
But the code is exactly same as on test hosting where everything works well and also the code is exactly same after downgrade PHP version..
Can anybody give me some hints to find the solution?

Fatal error: Interface 'JsonSerializable' not found in Cakephp

I'am getting below error. Please assist me in resolving this.
Fatal error: Interface 'JsonSerializable' not found in /home/onliuzgx/xyz.com/vendor/cakephp/cakephp/src/Mailer/Email.php on line 51
First you check your PHP version Cakephp requires 5.6.0 or greater (including PHP 7.2).
If you have proper PHP versoin you check your php.info Settings, if JSON is Enabled.
It will resolve the issue

Call to a member function num_rows() on boolean error in wamp and lamp but not in xampp

I am working on Point of sale system built on codeigniter. I get this error "Call to a member function num_rows() on boolean". I have just moved to linux and install lamp. I get the similar error on wamp, at that time i removed wamp and install xampp and it work. now i want to use lamp , every thing is good expect it get this error. I have changed php version but it does not help. i can not change in code because it has been used in hundred of places. currently i am using php PHP Version 7.0.27 , Apache/2.4.18, sql version :mysqladmin Ver 8.42 Distrib 5.7.20, for Linux on x86_64. also why it is working in xampp but give error on wamp and lamp,
Here is full error
An uncaught Exception was encountered
Type: Error
Message: Call to a member function num_rows() on boolean
Filename: /var/www/html/dev.com/public_html/gspos/app/models/admin/Products_model.php
Line Number: 206
Backtrace:
File: /var/www/html/dev.com/public_html/gspos/app/controllers/admin/Products.php
Line: 2053
Function: getAllWarehousesWithPQ
File: /var/www/html/dev.com/public_html/gspos/index.php
Line: 302
Function: require_once
I think you have code smells, but if you can't edit it, maybe check the differences between Xampp config and your new config and begin by check php version.
Thanks for the Help . I just installed Xampp and it solved my problem

Fatal Error: Call to undefined function gzopen() when installing WordPress theme

I'm seeing the below error after attempting to activate a WordPress theme. The error message in the browser is...
Fatal error: Call to undefined function gzopen() in /var/www/mysite.com/wp-content/themes/flat/themify/themify-builder/classes/class-themify-builder-layouts.php on line 528
Checking my /var/log/apache2/error.log I see the following error:
Call to undefined function gzopen() in /var/www/mywebsite.com/wp- content/themes/flat/themify/themify-builder/classes/class-themify-builder-layouts.php on line 528, referer: http://mywebsite.com/wp-admin/update.php?action=upload-theme
Server information:
OS: Ubuntu 14.04 LTS
Apache: APache/2.4.7
PHP: PHP 5.5.9-1ubuntu4
That happened with me too (after upgrading to 14.04 #ubuntu). I waisted my whole day on it but in the end i found the solution.
replace gzopen with gzopen64.
this absolutely worked for me.
PS: I'll like the magento community to know that this problems appeared in creating package, after upgrading apache and php.
This issue occurs because your PHP server is not compiled with Zlib (this PHP module allows you to read and write .gz compressed files). Zlib support in PHP is not enabled by default.
More information about how to setup Zlip can be found here: http://php.net/manual/en/zlib.setup.php

Call to undefined function openssl_pkcs7_sign()

I'm using TCPDF to sign son PFD documents.
I was testing the examples via web: http://www.tcpdf.org/examples.php, and they worked fine, but when I downloaded the lib and tested it # localhost I got this error in "example 52":
Fatal error: Call to undefined function openssl_pkcs7_sign() in
C:\xampp\htdocs\pruebas\pdf_firma\tcpdf\tcpdf.php on line 9043
My PHP is Version 5.3.8.
Any has any idea how to fix it?
Openssl must be installed
Enabling the OpenSSL in XAMPP
http://www.php.net/manual/en/openssl.setup.php

Categories