Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

webrobert's avatar

Deployment Issue ... wrong php version shown/called

Not sure what I've done.

Ran composer install --optimize-autoloader --no-dev

Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 0 installs, 0 updates, 41 removals

...
...

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In web.php line 21:
                                                                 
  syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')'  
                                                                 

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Ran php -v

PHP 8.0.12 (cli) (built: Oct 28 2021 15:25:09) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.12, Copyright (c) Zend Technologies
mydomain.com [~/public_html/sitename]# 

It's catching on the php8 syntax in my web.php first route of the file...

/*
|--------------------------------------------------------------------------
| General Page Routes
|--------------------------------------------------------------------------
*/

Route::get('/', fn () => view('home'))      // <-- this line
                ->name('home');
0 likes
8 replies
Sinnbeck's avatar

Run this to check which php version composer picks up

composer -vvv about 
webrobert's avatar

@Sinnbeck

ahh,

Running 2.0.6 (2020-11-07 11:21:17) with PHP 7.3.32 on Linux / 4.19.150-76.ELK.el7.x86_64

Ran composer -vvv about

Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Executing command (/home1/me/public_html/sitename): git branch -a --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: /home1/me/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /home1/me/public_html/sitename/vendor/composer/installed.json
Running 2.0.6 (2020-11-07 11:21:17) with PHP 7.3.32 on Linux / 4.19.150-76.ELK.el7.x86_64
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@webrobert you can try

php /path/to/composer install --optimize-autoloader --no-dev 
webrobert's avatar

@Sinnbeck,

Package manifest generated successfully.

Go to the website...

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.0".

webrobert's avatar

@Sinnbeck, @snapey

Ok, 2 parts to make this work (that I'm aware of.).

From my other Bluehost site. I found the command to run the path/to/composer bit... Sinnbeck prompted.

Also, I checked on the .htaccess of my other site, there was a cpanel generated handler. I copied it into this site...

<IfModule mime_module>
    AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
</IfModule>

success site works!

Snapey's avatar

ubuntu?

sudo update-alternatives --config php
webrobert's avatar

@Snapey it's bluehost. shared.

I have a site running here but can't remember what the hell I did to get it to work. Where is my SOP?

I

AM

WRITING

IT

DOWN

NOW

Please or to participate in this conversation.