The setup:di:compile
Magento 2 console command sometimes can product a «Segmentation failt» failure:
Any «Segmentation failt» means a bug in the PHP interpreter itself, not in the interpreted PHP code.
So what can you do?
Method 1 (The simpliest)
You can evade the setup:di:compile
usage at all by switching your Magento 2 installation to the developer mode:
- How to enable the developer mode?
- How to check with a console whether a store is in the developer or production mode?
Method 2. Use a more stable PHP interpreter version
At this moment, the «Segmentation failt» issues are usually encountered in some PHP 7 versions, e.g.
Try to use another PHP interpreter version.
Method 3. Try to remove the ionCube-encoded extensions
ionCube is a tool to obfuscate some PHP code.
Some developers use it to obfuscate their Magento extensions.
The obfuscated PHP code sometimes can break the setup:di:compile
tool.