PHP Parse error: syntax error, unexpected '$value' (T_VARIABLE) in aws/aws-sdk-php/src/functions.php on line 36 #731

Closed
opened 2026-02-04 22:05:29 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @KyferEz on GitHub (Jun 27, 2018).

For Bug Reports

  • BookStack Version (Found in settings, Please don't put 'latest'): v0.22.0
  • PHP Version: default 5.4, also have installed 7.1 as FPM/CGI
  • MySQL Version: Ver 15.1 Distrib 5.5.56-MariaDB
Expected Behavior

Use the configured PHP version for the site

Current Behavior

Uses default PHP version

Steps to Reproduce

Setup CentOS 7 Perfect server with ISPConfig using this guide: https://www.howtoforge.com/tutorial/perfect-server-centos-7-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/

Then install PHP7.1 using this guide: https://www.sunaryohadi.info/additional-php-versions-centos-7-nginx-ispconfig-3-gce.htm

Then create a site and set the site's PHP version to use 7.1

You will receive this error when trying to run "composer install":
PHP Parse error: syntax error, unexpected '$value' (T_VARIABLE) in /var/www/clients/client1/web1/web/docs/vendor/aws/aws-sdk-php/src/functions.php on line 36

Originally created by @KyferEz on GitHub (Jun 27, 2018). ### For Bug Reports * BookStack Version *(Found in settings, Please don't put 'latest')*: v0.22.0 * PHP Version: default 5.4, also have installed 7.1 as FPM/CGI * MySQL Version: Ver 15.1 Distrib 5.5.56-MariaDB ##### Expected Behavior Use the configured PHP version for the site ##### Current Behavior Uses default PHP version ##### Steps to Reproduce Setup CentOS 7 Perfect server with ISPConfig using this guide: https://www.howtoforge.com/tutorial/perfect-server-centos-7-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/ Then install PHP7.1 using this guide: https://www.sunaryohadi.info/additional-php-versions-centos-7-nginx-ispconfig-3-gce.htm Then create a site and set the site's PHP version to use 7.1 You will receive this error when trying to run "composer install": PHP Parse error: syntax error, unexpected '$value' (T_VARIABLE) in /var/www/clients/client1/web1/web/docs/vendor/aws/aws-sdk-php/src/functions.php on line 36
Author
Owner

@lommes commented on GitHub (Jun 27, 2018):

Please verify the PHP version you are using on cli is 5.5+ unsing php --version. This is the version composer tries to use and judging only by the error you posted this might still be 5.4.

You may also try running
PATH=$PATH:/path/to/your/directory/with/php/7.1 composer install
but I think this will still fail due to some scripts in composer.json, but you should get past the package installation with that.

@lommes commented on GitHub (Jun 27, 2018): Please verify the PHP version you are using on cli is 5.5+ unsing ```php --version```. This is the version composer tries to use and judging only by the error you posted this might still be 5.4. You may also try running ```PATH=$PATH:/path/to/your/directory/with/php/7.1 composer install``` but I think this will still fail due to some scripts in composer.json, but you should get past the package installation with that.
Author
Owner

@KyferEz commented on GitHub (Jun 27, 2018):

The CLI version is 5.4. I do not want to attempt to change that as there is a chance it will break the server.

The path statement did not work. I still get the same error. I'm pretty sure the reason is that PHP7.1 is installed using the REMI repo, so the name to execute is php71, not php.

`PATH=$PATH:/usr/bin/php71 composer install

php -r "!file_exists('bootstrap/cache/services.php') || @unlink('bootstrap/cache/services.php');"
php -r "!file_exists('bootstrap/cache/compiled.php') || @unlink('bootstrap/cache/compiled.php');"
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
PHP Parse error: syntax error, unexpected '$value' (T_VARIABLE) in /var/www/clients/client1/web1/web/docs/vendor/aws/aws-sdk-php/src/functions.php on line 36`

@KyferEz commented on GitHub (Jun 27, 2018): The CLI version is 5.4. I do not want to attempt to change that as there is a chance it will break the server. The path statement did not work. I still get the same error. I'm pretty sure the reason is that PHP7.1 is installed using the REMI repo, so the name to execute is php71, not php. `PATH=$PATH:/usr/bin/php71 composer install > php -r "!file_exists('bootstrap/cache/services.php') || @unlink('bootstrap/cache/services.php');" > php -r "!file_exists('bootstrap/cache/compiled.php') || @unlink('bootstrap/cache/compiled.php');" Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Nothing to install or update Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump PHP Parse error: syntax error, unexpected '$value' (T_VARIABLE) in /var/www/clients/client1/web1/web/docs/vendor/aws/aws-sdk-php/src/functions.php on line 36`
Author
Owner

@lommes commented on GitHub (Jun 27, 2018):

BookStack needs a newer PHP version than 5.4 even in the cli part.

Since your php 7.1 binary is not named php the command fails because it still uses php 5.4

You can try to create a symlink to the 7.1 binary and use this one in the path command line:

ln -s /usr/bin/php71 /tmp/php
PATH=$PATH:/tmp composer install

In this case the last found php binary will be used by composer.

@lommes commented on GitHub (Jun 27, 2018): BookStack needs a newer PHP version than 5.4 even in the cli part. Since your php 7.1 binary is not named php the command fails because it still uses php 5.4 You can try to create a symlink to the 7.1 binary and use this one in the path command line: ``` ln -s /usr/bin/php71 /tmp/php PATH=$PATH:/tmp composer install ``` In this case the last found php binary will be used by composer.
Author
Owner

@KyferEz commented on GitHub (Jun 27, 2018):

Didn't work, got the same error. Apparently the assertion that the last found php binary to be found will be used is somehow incorrect. Here I show the path setting was applied, but it is still using wrong version:

[root@s02 docs]# PATH=$PATH:/tmp && echo $PATH && php -v
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/admin/.local/bin:/home/admin/bin:/tmp
PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

@KyferEz commented on GitHub (Jun 27, 2018): Didn't work, got the same error. Apparently the assertion that the last found php binary to be found will be used is somehow incorrect. Here I show the path setting was applied, but it is still using wrong version: [root@s02 docs]# PATH=$PATH:/tmp && echo $PATH && php -v /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/admin/.local/bin:/home/admin/bin:/tmp PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
Author
Owner

@lommes commented on GitHub (Jun 27, 2018):

Ok, just checked. The first found executable in PATH is taken, so it should work if you change it to:
PATH=/tmp:$PATH

@lommes commented on GitHub (Jun 27, 2018): Ok, just checked. The first found executable in PATH is taken, so it should work if you change it to: ```PATH=/tmp:$PATH```
Author
Owner

@KyferEz commented on GitHub (Jun 27, 2018):

I had to also install php71-php-tidy from the REMI repo but once done it completed successfully! Thanks!

The rest of the install went without issue, however as I'm installing this to a site that has several things on the site (wordpress at site.com/, OTRS at site.com/otrs, and this at site.com/docs). So I can't alter the document root, as step 7 says, and I assume this is why I get a 403 error? Are there other options?

@KyferEz commented on GitHub (Jun 27, 2018): I had to also install php71-php-tidy from the REMI repo but once done it completed successfully! Thanks! The rest of the install went without issue, however as I'm installing this to a site that has several things on the site (wordpress at site.com/, OTRS at site.com/otrs, and this at site.com/docs). So I can't alter the document root, as step 7 says, and I assume this is why I get a 403 error? Are there other options?
Author
Owner

@lommes commented on GitHub (Jun 27, 2018):

BookStack should run fine if you symlink the public directory to some folder in your document root, see https://github.com/BookStackApp/BookStack/issues/291#issuecomment-276442469

You may need to add a rewrite base to the included htaccess file.

@lommes commented on GitHub (Jun 27, 2018): BookStack should run fine if you symlink the public directory to some folder in your document root, see https://github.com/BookStackApp/BookStack/issues/291#issuecomment-276442469 You may need to add a rewrite base to the included htaccess file.
Author
Owner

@KyferEz commented on GitHub (Jun 27, 2018):

Ok, so using that commend as a guide, I moved by BookStack folder and setup the synlink. It loads and works! YAAA! Thank you!

For posterity, and hopefully to help others, here's my config:

The Site's root path: /var/www/clients/client1/web1/web/
The Path to BookStack: /var/www/clients/client1/web1/web/BookStack
The symlink Used: cd /var/www/clients/client1/web1/web && ln -s BookStack/public docs

Also, I set the appurl in .env to: APP_URL=https://www.mysite.com/docs/

NOTE: In the APP_URL, the HTTP part needs to be either http or https depending upon your site settings. I was having trouble because I had the URL set as http when my site was auto-redirecting to https. I figured that out with Dev Tools; the non-loading CSS pages were showing a URL of http.

@KyferEz commented on GitHub (Jun 27, 2018): Ok, so using that commend as a guide, I moved by BookStack folder and setup the synlink. It loads and works! YAAA! Thank you! For posterity, and hopefully to help others, here's my config: The Site's root path: /var/www/clients/client1/web1/web/ The Path to BookStack: /var/www/clients/client1/web1/web/BookStack The symlink Used: cd /var/www/clients/client1/web1/web && ln -s BookStack/public docs Also, I set the appurl in .env to: APP_URL=https://www.mysite.com/docs/ NOTE: In the APP_URL, the HTTP part needs to be either http or https depending upon your site settings. I was having trouble because I had the URL set as http when my site was auto-redirecting to https. I figured that out with Dev Tools; the non-loading CSS pages were showing a URL of http.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#731