<p>The error message tells you that PHP encountered a syntax error while parsing the file <code>Installer.php</code>. Here's the line in question:</p>
<pre class="lang-php prettyprint-override"><code>private function _path(string $vendorDir, string $cwd, string $path): string
</code></pre>
<p>The error message (<code>syntax error, unexpected ':'</code>) tells you that PHP doesn't recognize the return type hint. Those were <a href="https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.return-type-declarations" rel="nofollow noreferrer">added in PHP 7.0</a> – so you're definitely using an older version, or you wouldn't be getting that error.</p>
<blockquote>
<p>All of the advice I can find says upgrade your PHP, but the server already has 7.3.31.</p>
</blockquote>
<p>The likeliest explanation is that the hosting company uses PHP 7.3 for web requests (for example, using PHP-FPM), but has not modified it's terminal / bash environment to use that version. Try running <code>php -v</code> in the terminal (while connected to the server over SSH) to see which version of PHP you're executing. You can also run composer with the <code>-vvv</code> flag to see which version of PHP it's using.</p>
<p>You're likely to see that <code>php</code> in the terminal is linked to an older version of PHP. In this case, you need to find out where the hoster keeps the binary for the current PHP version and execute the installation (and run composer) with that.</p>
<p>By the way, <a href="https://www.php.net/supported-versions.php" rel="nofollow noreferrer">security support for PHP 7.3</a> will run out in december 2021. If you're starting a new site, you should get started with PHP 8.0.</p>

CC BY-SA 4.0
2021-10-30T13:45:53.743Z
You were correct: running php -v returns 5.4.16. Thanks for the help, I never would have found that by myself.
mitrol
CC BY-SA 4.0
2021-10-31T14:30:52.693Z
@Mitrol Glad this worked for you! It's always annoying when the hoster doesn't consider CLI usage and doesn't synchronize their shell environments with the backend settings. Nowadays I use VPS by DigitalOcean or Hetzner instead, controlled by a server management tool like Laravel Forge. Way more control over your server environment and less annoyances with curious behaviours on shared hosting platforms.
MoritzLost
CC BY-SA 4.0
2021-10-28T13:34:40.217Z
2021-10-28T13:34:40.217Z
MoritzLost
<p>Installing Craft on MediaTemple. Ran the server check and it came back green except for the memory allocation, which I increased in the PHP.ini file.</p>
<p>Ran the composer install script and it runs fine until:</p>
<pre><code>- Installing craftcms/plugin-installer (1.5.7): Extracting archive
PHP Parse error:  syntax error, unexpected ':', expecting ';' or '{' in /var/www/vhosts/[example].com/beta.[example].com/vendor/craftcms/plugin-installer/src/Installer.php on line 471
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /var/www/vhosts/[example].com/beta.[example].com/vendor/craftcms/plugin-installer/src/Installer.php on line 471
</code></pre>
<p>As far as I can see, all the files are there.</p>
<p>All of the advice I can find says upgrade your PHP, but the server already has 7.3.31.</p>
<p>Any guidance much appreciated.</p>

<php><installation>
PHP Parse Error During Installation
# PHP Parse Error During Installation

(Asked by: username_0 on 2021-10-28)

Installing Craft on MediaTemple. Ran the server check and it came back green except for the memory allocation, which I increased in the PHP.ini file.
Ran the composer install script and it runs fine until:
- Installing craftcms/plugin-installer (1.5.7): Extracting archive
PHP Parse error:  syntax error, unexpected ':', expecting ';' or '{' in /var/www/vhosts/[example].com/beta.[example].com/vendor/craftcms/plugin-installer/src/Installer.php on line 471
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /var/www/vhosts/[example].com/beta.[example].com/vendor/craftcms/plugin-installer/src/Installer.php on line 471

As far as I can see, all the files are there.
All of the advice I can find says upgrade your PHP, but the server already has 7.3.31.
Any guidance much appreciated.

**Tags:** php, installation

---

## 1 answers

### Answer by username_1 on 2021-10-28. Score: 2 | Accepted answer

The error message tells you that PHP encountered a syntax error while parsing the file Installer.php. Here's the line in question:
private function _path(string $vendorDir, string $cwd, string $path): string

The error message (syntax error, unexpected ':') tells you that PHP doesn't recognize the return type hint. Those were added in PHP 7.0 – so you're definitely using an older version, or you wouldn't be getting that error.

All of the advice I can find says upgrade your PHP, but the server already has 7.3.31.

The likeliest explanation is that the hosting company uses PHP 7.3 for web requests (for example, using PHP-FPM), but has not modified it's terminal / bash environment to use that version. Try running php -v in the terminal (while connected to the server over SSH) to see which version of PHP you're executing. You can also run composer with the -vvv flag to see which version of PHP it's using.
You're likely to see that php in the terminal is linked to an older version of PHP. In this case, you need to find out where the hoster keeps the binary for the current PHP version and execute the installation (and run composer) with that.
By the way, security support for PHP 7.3 will run out in december 2021. If you're starting a new site, you should get started with PHP 8.0.

> **Comments:**
> **username_0**: You were correct: running php -v returns 5.4.16. Thanks for the help, I never would have found that by myself.  
> **username_1**: @Mitrol Glad this worked for you! It's always annoying when the hoster doesn't consider CLI usage and doesn't synchronize their shell environments with the backend settings. Nowadays I use VPS by DigitalOcean or Hetzner instead, controlled by a server management tool like Laravel Forge. Way more control over your server environment and less annoyances with curious behaviours on shared hosting platforms.  

---

