We have an application that is built on Symfony using Composer. I am trying to run this project on an M1 Mac but keep getting errors on various files saying that the file “could not be parsed as PHP” when trying to build the front end. The front end (AngularJS) appears to build without any errors, it’s just the back end that throws the error below.
I have tried adding memory to the Docker container thinking maybe it was a memory issue but that didn’t seem to make a difference. It doesn’t happen to the same file every time, which is why I originally thought it might be some sort of memory issue but that doesn’t appear to be the case as increasing memory did not prevent the error.
I had to jump through a bunch of hoops to get to this point due to various issues with the M1 chipset but it seems like the front end builds okay but the back end has issues with PHP files it seems.
Haven’t found much useful information on that failure to parse error but it is most likely specific to the M1 chipset. Has anyone run into this before?
Here are the results of a few tests. After the first test I deleted the vendor dir again but after the second test I just ran composer install again and it gave the same error with a different file name.
TEST 1
Generating optimized autoload files
In PhpFileParser.php line 51:
File at "/var/www/html/api/vendor/beberlei/doctrineextensions/src/Query/Sqlit
e/ConcatWs.php" could not be parsed as PHP, it may be binary or corrupted
TEST 2
Generating optimized autoload files
In PhpFileParser.php line 51:
File at "/var/www/html/api/vendor/symfony/symfony/src/Symfony/Component/Cache
/DependencyInjection/CacheCollectorPass.php" could not be parsed as PHP, it m
ay be binary or corrupted
composer install without delete:
Generating optimized autoload files
In PhpFileParser.php line 51:
File at "/var/www/html/api/vendor/symfony/polyfill-mbstring/bootstrap80.php"
could not be parsed as PHP, it may be binary or corrupted
again:
Generating optimized autoload files
In PhpFileParser.php line 51:
File at "/var/www/html/api/vendor/pagerfanta/pagerfanta/lib/Core/Exception/Ex
ception.php" could not be parsed as PHP, it may be binary or corrupted
next time:
Generating optimized autoload files
In PhpFileParser.php line 51:
File at "/var/www/html/api/vendor/symfony/symfony/src/Symfony/Bundle/Framewor
kBundle/Command/TranslationUpdateCommand.php" could not be parsed as PHP, it
may be binary or corrupted
and next:
Generating optimized autoload files
In PhpFileParser.php line 51:
File at "/var/www/html/api/vendor/friendsofsymfony/elastica-bundle/src/Depend
encyInjection/FOSElasticaExtension.php" could not be parsed as PHP, it may be
binary or corrupted
I’ve searched every forum I could find but there really doesn’t appear to even be any mention of this error anywhere. I’m fairly new to Docker as we have really just made the switch since VirtualBox bit the dust. Everything ran fine on VB but unfortunately it looks like that is no longer an option with newer machines.
Note: Stack is being built with docker compose. I have attempted to change the memory_limit in the docker compose file as well as in the php.ini and also by specifying a memory limit with the docker install command.