今日执行composer update
结果出现下面错误提示:
PHP Parse error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /www/wwwroot/bbs.cltserver.xyz/vendor/ocramius/package-versions/src/PackageVersions/Installer.php on line 33
Parse error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /www/wwwroot/bbs.cltserver.xyz/vendor/ocramius/package-versions/src/PackageVersions/Installer.php on line 33
在网上搜索了一下,大概意思是PHP7.4版本安装了Flarum,然后又把PHP进行降级到PHP7.3版本就会出现这种错误提示。
于是我尝试更换PHP版本至PHP7.4……
由于之前论坛更换域名,在PhpMyAdmin当中进行搜索操作的时候有报错,所以PHP版本更新至7.4并且升级了PhpMyAdmin版本,之后没有问题,现在想想也不确定两者之间到底是升级了PHP解决还是升级了PhpMyAdmin解决搜索抱错的问题。
那既然如此,我们试试切换PHP版本至7.4先看看。
还是一样唉。
为了以防万一某些配置需要重启动作,我索性重启整台伺服器一次。
然后再试试结果也是一样。
网上又找到一篇类似问题的教程,对方让我们把composer.lock
以及vendor
删掉,然后运行一次composer install
,我用屁股想了想,vendor
里面有插件文件,每个人论坛插件肯定都是不一样的配置,所以以防万一,我把两份文件进行了备份处理,然后从根目录删掉。
然后我们执行一次composer install
[root@CLT_WEB bbs.cltserver.xyz]# composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 203 installs, 0 updates, 0 removals
- Installing kylekatarnls/update-helper (1.2.1): Loading from cache
- Installing ocramius/package-versions (1.5.1): Downloading (100%)
- Installing laminas/laminas-zendframework-bridge (1.0.3): Loading from cache
- Installing laminas/laminas-escaper (2.6.1): Loading from cache
- Installing psr/http-message (1.0.1): Loading from cache
- Installing psr/http-server-handler (1.0.1): Loading from cache
- Installing psr/http-server-middleware (1.0.1): Loading from cache
- Installing fig/http-message-util (1.1.4): Loading from cache
- Installing laminas/laminas-stratigility (3.2.2): Loading from cache
- Installing psr/http-factory (1.0.1): Loading from cache
- Installing laminas/laminas-diactoros (1.8.7p2): Loading from cache
- Installing ralouphie/getallheaders (3.0.3): Loading from cache
- Installing guzzlehttp/psr7 (1.6.1): Loading from cache
- Installing laminas/laminas-httphandlerrunner (1.1.0): Loading from cache
- Installing tobscure/json-api (v0.3.0): Loading from cache
- Installing symfony/polyfill-ctype (v1.15.0): Loading from cache
- Installing symfony/yaml (v3.4.39): Loading from cache
- Installing symfony/polyfill-mbstring (v1.15.0): Loading from cache
- Installing symfony/translation (v3.4.39): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing symfony/service-contracts (v2.0.1): Loading from cache
- Installing symfony/polyfill-php73 (v1.15.0): Loading from cache
- Installing symfony/console (v4.4.7): Loading from cache
- Installing symfony/filesystem (v4.4.7): Loading from cache
- Installing symfony/config (v3.4.39): Loading from cache
- Installing nikic/fast-route (v0.6.0): Loading from cache
- Installing psr/log (1.1.3): Loading from cache
- Installing monolog/monolog (1.25.3): Loading from cache
- Installing middlewares/utils (v2.2.0): Loading from cache
- Installing middlewares/request-handler (v1.4.0): Loading from cache
- Installing middlewares/base-path-router (v0.2.1): Loading from cache
- Installing middlewares/base-path (v1.1.0): Loading from cache
- Installing matthiasmullie/path-converter (1.1.3): Loading from cache
- Installing matthiasmullie/minify (1.3.63): Loading from cache
- Installing league/flysystem (1.0.66): Loading from cache
- Installing intervention/image (2.5.1): Loading from cache
- Installing symfony/debug (v4.4.7): Loading from cache
- Installing nesbot/carbon (1.39.1): Loading from cache
- Installing psr/simple-cache (1.0.1): Loading from cache
- Installing illuminate/contracts (v5.7.28): Loading from cache
- Installing doctrine/inflector (1.3.1): Loading from cache
- Installing illuminate/support (v5.7.28): Loading from cache
- Installing symfony/finder (v4.4.7): Loading from cache
- Installing illuminate/filesystem (v5.7.28): Loading from cache
- Installing illuminate/container (v5.7.28): Loading from cache
- Installing illuminate/events (v5.7.28): Loading from cache
- Installing illuminate/view (v5.7.28): Loading from cache
- Installing symfony/polyfill-php72 (v1.15.0): Loading from cache
- Installing symfony/polyfill-intl-idn (v1.15.0): Loading from cache
- Installing symfony/mime (v5.0.7): Loading from cache
- Installing symfony/http-foundation (v4.4.7): Loading from cache
- Installing illuminate/translation (v5.7.28): Loading from cache
- Installing illuminate/validation (v5.7.28): Loading from cache
- Installing illuminate/session (v5.7.28): Loading from cache
- Installing symfony/css-selector (v5.0.7): Loading from cache
- Installing tijsverkoyen/css-to-inline-styles (2.2.2): Loading from cache
- Installing symfony/polyfill-iconv (v1.15.0): Loading from cache
- Installing doctrine/lexer (1.2.0): Loading from cache
- Installing egulias/email-validator (2.1.17): Loading from cache
- Installing swiftmailer/swiftmailer (v6.2.3): Loading from cache
- Installing erusev/parsedown (1.7.4): Loading from cache
- Installing illuminate/mail (v5.7.28): Loading from cache
- Installing illuminate/hashing (v5.7.28): Loading from cache
- Installing illuminate/database (v5.7.28): Loading from cache
- Installing illuminate/config (v5.7.28): Loading from cache
- Installing illuminate/cache (v5.7.28): Loading from cache
- Installing illuminate/pipeline (v5.7.28): Loading from cache
- Installing illuminate/bus (v5.7.28): Loading from cache
- Installing filp/whoops (2.7.1): Loading from cache
- Installing franzl/whoops-middleware (0.4.1): Loading from cache
- Installing doctrine/event-manager (1.1.0): Loading from cache
- Installing doctrine/cache (1.10.0): Loading from cache
- Installing doctrine/dbal (v2.10.1): Loading from cache
- Installing dflydev/fig-cookies (v1.0.2): Loading from cache
- Installing components/font-awesome (5.9.0): Loading from cache
- Installing axy/backtrace (1.0.7): Loading from cache
- Installing axy/errors (1.0.5): Loading from cache
- Installing axy/codecs-base64vlq (1.0.1): Loading from cache
- Installing axy/sourcemap (0.1.4): Loading from cache
- Installing paragonie/random_compat (v9.99.99): Loading from cache
- Installing wikimedia/less.php (v2.0.0): Loading from cache
- Installing symfony/event-dispatcher-contracts (v1.1.7): Loading from cache
- Installing symfony/event-dispatcher (v4.4.7): Loading from cache
- Installing s9e/regexp-builder (1.4.4): Loading from cache
- Installing s9e/text-formatter (2.4.1): Downloading (100%)
- Installing symfony/process (v4.4.7): Loading from cache
- Installing opis/closure (3.5.1): Loading from cache
- Installing illuminate/console (v5.7.28): Loading from cache
- Installing illuminate/queue (v5.7.28): Loading from cache
- Installing flarum/core (v0.1.0-beta.12): Loading from cache
- Installing fof/components (0.1.1): Loading from cache
- Installing askvortsov/flarum-categories (v0.2.6): Loading from cache
- Installing askvortsov/flarum-pwa (v0.1.12): Loading from cache
- Installing guzzlehttp/promises (v1.3.1): Loading from cache
- Installing guzzlehttp/guzzle (6.5.2): Loading from cache
- Installing c78/flarum-ext-mediaembed-https (0.1.0): Loading from cache
- Installing clarkwinkelmann/flarum-ext-emojionearea (0.2.1): Loading from cache
- Installing mtdowling/cron-expression (v1.2.3): Loading from cache
- Installing fof/console (0.5.2): Loading from cache
- Installing seld/phar-utils (1.1.0): Loading from cache
- Installing seld/jsonlint (1.7.2): Loading from cache
- Installing justinrainbow/json-schema (5.2.9): Loading from cache
- Installing composer/xdebug-handler (1.4.1): Loading from cache
- Installing composer/spdx-licenses (1.5.3): Loading from cache
- Installing composer/semver (1.5.1): Loading from cache
- Installing composer/ca-bundle (1.2.7): Loading from cache
- Installing composer/composer (1.10.5): Downloading (100%)
- Installing extiverse/bazaar (0.4.1): Loading from cache
- Installing fof/ban-ips (0.1.5): Loading from cache
- Installing fof/bbcode-details (0.1.0): Loading from cache
- Installing fof/bbcode-tabs (0.1.1): Loading from cache
- Installing fof/best-answer (0.1.7): Loading from cache
- Installing fof/custom-footer (0.1.3): Loading from cache
- Installing fof/discussion-thumbnail (0.1.0): Loading from cache
- Installing fgribreau/mailchecker (v3.3.4): Loading from cache
- Installing fof/disposable-emails (0.1.0): Loading from cache
- Installing fof/drafts (0.1.5): Loading from cache
- Installing fof/formatting (0.1.4): Loading from cache
- Installing fof/forum-statistics-widget (0.1.1): Loading from cache
- Installing fof/gamification (0.1.8): Loading from cache
- Installing fof/geoip (0.1.7): Loading from cache
- Installing fof/html-errors (0.3.1): Loading from cache
- Installing fof/ignore-users (0.1.5): Loading from cache
- Installing fof/linguist (0.4.2): Loading from cache
- Installing fof/links (0.2.1): Loading from cache
- Installing fof/merge-discussions (0.3.3): Loading from cache
- Installing fof/nightmode (0.4.0): Loading from cache
- Installing fof/pages (0.3.1): Loading from cache
- Installing fof/polls (0.1.2): Loading from cache
- Installing fof/profile-image-crop (0.1.1): Loading from cache
- Installing fof/pwned-passwords (0.4.0): Loading from cache
- Installing fof/reactions (0.2.4): Loading from cache
- Installing fof/realtimedate (0.1.2): Loading from cache
- Installing psr/http-client (1.0.0): Loading from cache
- Installing php-http/promise (v1.0.0): Loading from cache
- Installing php-http/httplug (2.1.0): Loading from cache
- Installing php-http/guzzle6-adapter (v2.0.1): Loading from cache
- Installing http-interop/http-factory-guzzle (1.0.0): Loading from cache
- Installing symfony/polyfill-uuid (v1.15.0): Loading from cache
- Installing symfony/options-resolver (v5.0.7): Loading from cache
- Installing clue/stream-filter (v1.4.1): Loading from cache
- Installing php-http/message-factory (v1.0.2): Loading from cache
- Installing php-http/message (1.8.0): Loading from cache
- Installing php-http/discovery (1.7.4): Loading from cache
- Installing php-http/client-common (2.1.0): Loading from cache
- Installing jean85/pretty-package-versions (1.2): Loading from cache
- Installing sentry/sentry (2.3.2): Loading from cache
- Installing sentry/sdk (2.1.0)
- Installing ramsey/uuid (3.9.3): Loading from cache
- Installing fof/sentry (0.4.8): Loading from cache
- Installing fof/extend (0.2.0): Loading from cache
- Installing fof/share-social (0.1.2): Loading from cache
- Installing fof/socialprofile (0.1.2): Loading from cache
- Installing fof/terms (0.4.1): Loading from cache
- Installing softcreatr/php-mime-detector (3.0.0): Loading from cache
- Installing fof/upload (0.8.5): Loading from cache
- Installing fof/user-bio (0.1.3): Loading from cache
- Installing fof/user-directory (0.3.4): Loading from cache
- Installing fof/username-request (0.2.0): Loading from cache
- Installing hightman/xunsearch (1.4.14): Loading from cache
- Installing jjandxa/flarum-ext-chinese-search (0.0.9): Loading from cache
- Installing jordanjay29/flarum-ext-summaries (0.3.1): Loading from cache
- Installing lcinhk/flarum-ext-acgembed (v0.5): Loading from cache
- Installing michaelbelgium/flarum-discussion-views (v3.2.0): Loading from cache
- Installing nomiscz/flarum-ext-auth-steam (v0.1.6): Loading from cache
- Installing reflar/cookie-consent (0.2.0): Loading from cache
- Installing squeevee/flarum-ext-fancybox (0.2-beta): Loading from cache
- Installing cbschuld/browser.php (v1.9.6): Downloading (100%)
- Installing tank/polyfills (v0.1.0): Loading from cache
- Installing the-turk/flarum-mathren (0.2.6): Loading from cache
- Installing flarum/markdown (v0.1.0-beta.12): Loading from cache
- Installing xelson/flarum-ext-chat (0.7.3): Loading from cache
- Installing zerosonesfun/font (1.1): Loading from cache
- Installing clarkwinkelmann/flarum-ext-see-past-first-post (1.0.3): Loading from cache
- Installing csineneo/lang-simplified-chinese (1.12.10): Loading from cache
- Installing csineneo/lang-traditional-chinese (1.12.10): Loading from cache
- Installing flarum/flags (v0.1.0-beta.12): Loading from cache
- Installing flarum/approval (v0.1.0-beta.12): Loading from cache
- Installing league/oauth2-client (2.4.1): Loading from cache
- Installing league/oauth2-facebook (2.0.1): Loading from cache
- Installing flarum/auth-facebook (v0.1.0-beta.12): Loading from cache
- Installing league/oauth2-github (2.0.0): Loading from cache
- Installing flarum/auth-github (v0.1.0-beta.12): Loading from cache
- Installing league/oauth1-client (1.7.0): Loading from cache
- Installing flarum/auth-twitter (v0.1.0-beta.12): Loading from cache
- Installing flarum/bbcode (v0.1.0-beta.12): Loading from cache
- Installing flarum/emoji (v0.1.0-beta.12): Loading from cache
- Installing flarum/lang-english (v0.1.0-beta.12): Loading from cache
- Installing flarum/likes (v0.1.0-beta.12): Loading from cache
- Installing flarum/lock (v0.1.0-beta.12): Loading from cache
- Installing flarum/mentions (v0.1.0-beta.12): Loading from cache
- Installing pusher/pusher-php-server (2.6.4): Loading from cache
- Installing flarum/pusher (v0.1.0-beta.12): Loading from cache
- Installing flarum/statistics (v0.1.0-beta.12): Loading from cache
- Installing flarum/sticky (v0.1.0-beta.12): Loading from cache
- Installing flarum/subscriptions (v0.1.0-beta.12): Loading from cache
- Installing flarum/suspend (v0.1.0-beta.12): Loading from cache
- Installing flarum/tags (v0.1.0-beta.12): Loading from cache
- Installing wohali/oauth2-discord-new (v1.0.0): Loading from cache
- Installing fof/auth-discord (0.1.3): Loading from cache
- Installing fof/byobu (0.4.5): Loading from cache
- Installing fof/split (0.4.3): Loading from cache
- Installing therealsujitk/flarum-ext-hljs (v1.1.3): Loading from cache
symfony/service-contracts suggests installing symfony/service-implementation
symfony/console suggests installing symfony/lock
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
matthiasmullie/minify suggests installing psr/cache-implementation (Cache implementation to use with Minify::cache)
league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem)
league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files)
league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage)
league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage)
league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2)
league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3)
league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox storage)
league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use Dropbox storage for PHP 5 applications)
league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching)
league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib)
league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter)
intervention/image suggests installing intervention/imagecache (Caching extension for the Intervention Image library)
illuminate/support suggests installing moontoast/math (Required to use ordered UUIDs (^1.1).)
illuminate/support suggests installing symfony/var-dumper (Required to use the dd function (^4.1).)
illuminate/filesystem suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (^1.0).)
illuminate/filesystem suggests installing league/flysystem-cached-adapter (Required to use the Flysystem cache (^1.0).)
illuminate/filesystem suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (^1.0).)
illuminate/filesystem suggests installing league/flysystem-sftp (Required to use the Flysystem SFTP driver (^1.0).)
swiftmailer/swiftmailer suggests installing true/punycode (Needed to support internationalized email addresses, if ext-intl is not installed)
illuminate/mail suggests installing aws/aws-sdk-php (Required to use the SES mail driver (^3.0).)
illuminate/database suggests installing fzaninotto/faker (Required to use the eloquent factory builder (^1.4).)
illuminate/database suggests installing illuminate/pagination (Required to paginate the result set (5.7.*).)
illuminate/cache suggests installing illuminate/redis (Required to use the redis cache driver (5.7.*).)
filp/whoops suggests installing symfony/var-dumper (Pretty print complex values better with var-dumper available)
filp/whoops suggests installing whoops/soap (Formats errors as SOAP responses)
doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use legacy MongoDB driver)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
symfony/event-dispatcher-contracts suggests installing psr/event-dispatcher
symfony/event-dispatcher suggests installing symfony/dependency-injection
symfony/event-dispatcher suggests installing symfony/http-kernel
s9e/text-formatter suggests installing ext-xsl (Enables the XSLT renderer)
illuminate/console suggests installing dragonmantank/cron-expression (Required to use scheduling component (^2.0).)
illuminate/queue suggests installing aws/aws-sdk-php (Required to use the SQS queue driver (^3.0).)
illuminate/queue suggests installing illuminate/redis (Required to use the Redis queue driver (5.7.*).)
illuminate/queue suggests installing pda/pheanstalk (Required to use the Beanstalk queue driver (^3.0|^4.0).)
symfony/polyfill-uuid suggests installing ext-uuid (For best performance)
php-http/message suggests installing slim/slim (Used with Slim Framework PSR-7 implementation)
php-http/discovery suggests installing puli/composer-plugin (Sets up Puli which is recommended for Discovery to work. Check http://docs.php-http.org/en/latest/discovery.html for more details.)
php-http/client-common suggests installing php-http/logger-plugin (PSR-3 Logger plugin)
php-http/client-common suggests installing php-http/cache-plugin (PSR-6 Cache plugin)
php-http/client-common suggests installing php-http/stopwatch-plugin (Symfony Stopwatch plugin)
ramsey/uuid suggests installing ext-libsodium (Provides the PECL libsodium extension for use with the SodiumRandomGenerator)
ramsey/uuid suggests installing ext-uuid (Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator)
ramsey/uuid suggests installing moontoast/math (Provides support for converting UUID to 128-bit integer (in string form).)
ramsey/uuid suggests installing ramsey/uuid-console (A console application for generating UUIDs with ramsey/uuid)
ramsey/uuid suggests installing ramsey/uuid-doctrine (Allows the use of Ramsey\Uuid\Uuid as Doctrine field type.)
ramsey/uuid suggests installing paragonie/random-lib (Provides RandomLib for use with the RandomLibAdapter)
fof/upload suggests installing league/flysystem-aws-s3-v3 (Uploads to AWS S3 using API version 3.)
fof/upload suggests installing overtrue/flysystem-qiniu (Uploads to QiNiu using API.)
michaelbelgium/flarum-discussion-views suggests installing rooaaar/lang-french-extended (Includes French translation for this extension)
michaelbelgium/flarum-discussion-views suggests installing michaelbelgium/flarum-dutch (Includes Dutch translation for this extension)
michaelbelgium/flarum-discussion-views suggests installing dynastyking/flarum-lang-ptbr (Includes Brazilian Portuguese translation for this extension)
michaelbelgium/flarum-discussion-views suggests installing rob006/flarum-lang-polish (Includes Polish translation for this extension)
Package mtdowling/cron-expression is abandoned, you should avoid using it. Use dragonmantank/cron-expression instead.
Writing lock file
Generating autoload files
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
居然安装了,但是安装归安装,这时候我们插件都全部抱错了唉!
覆盖回去vendor
试试,结果依然不行,看来只能试试其它方法了。
以上都是废话,只是为了让文章看起来更加臃肿而已,解决办法是这一句:
我之后把PHP-CLI命令行执行版本切换成7.4,居然解决了……
这个贴水的怎么样XD