Welcome Guest, Not a member yet? Register   Sign In
Parse Error in Production and Not Local Server

Hello. I'm new to the forum but not new to CI. Been a user since CI3. I just downloaded a fresh copy of CI and developed a starter site in WAMP. All was working great; pushed it over to production server and it wont load. The server error log says:

Error Log Excerpt
[12-Oct-2021 14:45:24 America/Chicago] PHP Parse error:  syntax error, unexpected ':', expecting '{' in /mysite/system/Common.php on line 44

System/Common.php Excerpt
if (! function_exists('app_timezone')) {
    * Returns the timezone the application has been set to display
    * dates in. This might be different than the timezone set
    * at the server level, as you often want to stores dates in UTC
    * and convert them on the fly for the user.
    function app_timezone(): string    /**Line 44*/
        $config = config(App::class);

        return $config->appTimezone;

Just as the CI user's guide says, I did not modify any sys files.

Anyone run into the same issue?  I researched a bit but never found anything. Any/all help on this would be greatly appreciated. [/code]

What version of PHP? CI4 require PHP 7.3
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/

(This post was last modified: 10-13-2021, 06:19 AM by jdmdigital.)

Thanks for asking. I forgot to mention the server php version.

Localhost: 7.3.21
production: 7.4

I think i'll retrograde my production server to see if that fixes it. but CI4 says 7.3 or younger.

update: retrograde to 7.3 on production worked. should I report this to the devs so they can look into a 7.4 fix?

Dev here. That's weird, return types were introduced in PHP 7 so it being at 7.4 doesn't matter.

I'm running on php 8.0.11 and never seen a problem like that.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

I just switched my localhost server to php7.4.9 and cycled through the site; no issues. I'll upgrade the production site back to 7.4 this weekend and see if the bug remains or was a fluke.

Theme © iAndrew 2016 - Forum software by © MyBB