0

I am generating QR code using endroid.

I am facing issue while generating QR code on server. Its working fine on local system.

My local php version is 7.3.7 and server php version is 7.0.20

My QR code php file like this


<?php 
//$code = $_GET["code"];
header("Content-Type: image/png");
require "qr/vendor/autoload.php";
use Endroid\QrCode\QrCode;
$qrCode = new QrCode("pankaj");
header('Content-Type: '.$qrCode->getContentType());
echo  $qrCode->writeString();
?>


Meet Patel
  • 105
  • 8
  • 2
    "500 server error" means there was an error on the server. Check your PHP logs, turn on error reporting, etc. (https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display) You need to find out what the error is before you can correct it. – David Nov 13 '19 at 11:48
  • what does your error log say? enable error reporting so u can see the error – Masivuye Cokile Nov 13 '19 at 11:49
  • 3
    From the GitHub page of endroid, file composer.json: `"require": {"php": ">=7.2",` Update your PHP version on the server – brombeer Nov 13 '19 at 11:50
  • Can you suggest Any QR code library that use `7.0` or less version ? @kerbholz – Meet Patel Nov 13 '19 at 11:59
  • 1
    No, I can't, sorry. Your favorite search engine might though – brombeer Nov 13 '19 at 12:01
  • PHP 7.0 is out of support (see https://www.php.net/supported-versions.php) so you should be upgrading your server anyway...and as a bonus, once you do that you can use this library. – ADyson Nov 13 '19 at 13:00
  • I believe imagick library is missing can you please check with your phpinfo? – Rushabh Rakholiya Nov 13 '19 at 13:00
  • @RushabhRakholiya what makes you believe that, exactly? There is no evidence in the question for it. The only concrete evidence we have of a likely problem is the PHP version, which we have already dealt with in the comments above. And adding imagick (assuming it's even missing) won't make any difference until that is resolved. It's usually unwise to speculate on the causes of problems without even a hint that the cause you're talking about could be relevant. – ADyson Nov 13 '19 at 13:02
  • @ADyson I had the same problem previously and it was solved, if he can check with phpinfo and if too installed that lib to solve this problem is create a problem?? – Rushabh Rakholiya Nov 13 '19 at 13:05
  • @RushabhRakholiya only that it wastes time when we have no idea if it's relevant or not. Better thing would be for OP to upgrade to a supported PHP version, and then see if they still have a problem. At that time if there's still an error they can check the **real** error message, and if it relates to imageMagick they can then follow your advice. No point spending time investigating something "just in case". Just because you had some problem with it does not mean this one is identical. Try to deal with the actual situation rather than an imagined one. Wait for evidence before taking action. – ADyson Nov 13 '19 at 13:07

0 Answers0