Parse error after deploying to production via manually copying files

I am trying to get userfrosting up on Mac OS Sierra with php 5.6.3. I have been using a local environment for over a year now so the local server has been working fine. When I got through with the install I loaded http://localhost/userfrosting/public/ and receive the following message:

UserFrosting Application Error

Parse error: parse error, expecting `"variable (T_VARIABLE)"' in /Library/WebServer/Documents/userfrosting/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 40

I doubt that that line is the issue but rather something else is wrong. Here are the relevant lines of that file anyways:

    private const PARAM_TYPE_MAP = [              //This is line 40
        ParameterType::NULL         => PDO::PARAM_NULL,
        ParameterType::INTEGER      => PDO::PARAM_INT,
        ParameterType::STRING       => PDO::PARAM_STR,
        ParameterType::LARGE_OBJECT => PDO::PARAM_LOB,
        ParameterType::BOOLEAN      => PDO::PARAM_BOOL,

I found some information to a similar problem on a laracasts thread about a “splat operator” before 5.6.4 causing issues but my version is 5.6 or greater as per userfrost docs which should be sufficient.
Any help would be much appreciated.

Can you try running composer show to see which version of the Doctrine package has been installed?

doctrine/annotations v1.6.0 Docblock Annotations…
doctrine/cache v1.7.1 Caching library offe…
doctrine/collections v1.5.0 Collections Abstract…
doctrine/common v2.8.1 Common Library for D…
doctrine/dbal v2.7.1 Database Abstraction…
doctrine/inflector v1.3.0 Common String Manipu…
doctrine/instantiator 1.1.0 A small, lightweight…
doctrine/lexer v1.0.1 Base library for a l…

It looks like the version of doctrine/dbal that you have installed, 2.7.1, depends on PHP 7.1 or higher. See dbal/composer.json at 11037b4352c008373561dc6fc836834eed80c3b5 · doctrine/dbal · GitHub

Is it possible that you installed the composer dependencies in an environment with PHP 7.1, but then manually copied the vendor/ directory over to another environment that only has PHP 5.6?

Also, sorry that you got auto-muted. Apparently Discourse thought you “typed too fast” and assumed you were a bot. I’ve unmuted you :stuck_out_tongue:

That is exactly what happened!
I set it up outside of the web server then copied it in.
php -v output 7.1.x but <?php echo phpinfo(); returns the 5.6.x number.
I broke the link to php 7 and am back in business.

Thank you for clearing that up for me so quickly!

1 Like