0

Recenty I was updating some code on my Laravel app and I managed to get it working perfectly on local, no error messages whatsoever, so I decided to upload it to the test server.

When I did, this laminas-diactoros package started giving this error message:

PHP Parse error: syntax error, unexpected 'fn' (T_STRING), expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /route/to/MyProject/vendor/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php on line 29

After some research I learned that this is because in php7.4 fn is a reserved word, so I then did composer require laminas/laminas-diactoros to see if updating the package would make it change syntax and work allright. It wont update further than 2.17 and in that version it still uses fn. I don't know what else to see or to do. I'm using laravel 6.20.44, php 7.4 and apache2. If you need any more information just ask and I'll try to answer quick, but this is literally everything I can think of that could be failing.

1 Answer 1

0

As answered by Froschdesign in this post on Disclosure Laminas. The problem you're facing is with PHP version conflict between cli and apache2. Your command line shows PHP version 7.4 but confirm in your CPanel and in the Apache virtual host file which version is being used by Apache. Thanks!

<?php
// below information gives you the version being used by Apache.
phpinfo();
// below command tells you the version of PHP in the command line.
$ php --version
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.