Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Parse error: syntax error, unexpected 'static' (T_STATIC) in phar (using phpbu-6.0.20.phar with php 7.4.33) #378

Open
atrandafir opened this issue Apr 29, 2024 · 1 comment

Comments

@atrandafir
Copy link

atrandafir commented Apr 29, 2024

Well basically I've got PHP 7.4.33 running.

I've downloaded the phar file from https://phar.phpbu.de/phpbu-6.0.20.phar that apparently is compatible with my php version.

Then when I run it:

-bash-4.2$ /opt/plesk/php/7.4/bin/php /var/www/vhosts/example.com/httpdocs/phpbu-6.0.20.phar --configuration=/var/www/vhosts/example.com/httpdocs/config/phpbu.xml
phpbu 6.0.20 by Sebastian Feldmann and contributors.

Runtime:       PHP 7.4.33
Configuration: /var/www/vhosts/example.com/httpdocs/config/phpbu.xml

PHP Parse error:  syntax error, unexpected 'static' (T_STATIC) in phar:///var/www/vhosts/example.com/httpdocs/phpbu-6.0.20.phar/lib/symfony/process/Process.php on line 190

But the same phpbu version installed with composer as a dependency inside my php application, it works!

-bash-4.2$ /opt/plesk/php/7.4/bin/php /var/www/vhosts/example.com/httpdocs/vendor/bin/phpbu --configuration=/var/www/vhosts/example.com/httpdocs/config/phpbu.xml
phpbu 6.0.20 by Sebastian Feldmann and contributors.

Runtime:       PHP 7.4.33
Configuration: /var/www/vhosts/example.com/httpdocs/config/phpbu.xml

Time: 2 seconds, Memory: 16.00MB

backup mysql_main_db: OK

          | executed | skipped | failed |
----------+----------+---------+--------+
 checks   |        0 |         |      0 |
 crypts   |        0 |       0 |      0 |
 syncs    |        1 |       0 |      0 |
 cleanups |        1 |       0 |      0 |
----------+----------+---------+--------+

backup mysql_stats_db: OK

          | executed | skipped | failed |
----------+----------+---------+--------+
 checks   |        0 |         |      0 |
 crypts   |        0 |       0 |      0 |
 syncs    |        1 |       0 |      0 |
 cleanups |        1 |       0 |      0 |
----------+----------+---------+--------+

backup files_daily_uploads: OK

          | executed | skipped | failed |
----------+----------+---------+--------+
 checks   |        0 |         |      0 |
 crypts   |        0 |       0 |      0 |
 syncs    |        1 |       0 |      0 |
 cleanups |        1 |       0 |      0 |
----------+----------+---------+--------+

backup files_incremental_uploads_documentacion: OK

          | executed | skipped | failed |
----------+----------+---------+--------+
 checks   |        0 |         |      0 |
 crypts   |        0 |       0 |      0 |
 syncs    |        1 |       0 |      0 |
 cleanups |        1 |       0 |      0 |
----------+----------+---------+--------+

OK (4 backups, 0 checks, 0 crypts, 4 syncs, 4 cleanups)

So why composer installed version is working but the downloaded phar doesn't?

@hype09
Copy link
Contributor

hype09 commented May 16, 2024

That error message looks like the 6.0.20 release .phar file was compiled with dependencies (i.e. symfony/process) that are "too new" and don't support PHP 7.x anymore.

I don't know the exact build process, but my guess is that it was done on a system that had PHP 8.X installed, so Composer thought it could fetch modern dependency versions, which were then baked into the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants