Configuring PHP
PHP configuration is stored within the cma.js
file:
Changing the PHP version
The default version of PHP supplied with Create Magento App is 7.4.13
. In order to change it, cma.js
will have to be adjusted accordingly:
After changing the configuration, restart the app to install the new PHP version:
And validate the new PHP installation through the CLI:
Installing PHP extensions
By default, only the extensions that are required by Magento are installed. If you need to install any additional extensions, cma.js will have to be changed accordingly:
You can specify the version of the extension explicitly (like with sphinx
) or install the latest available version automatically by leaving the object empty (like with memcached
). Restart the app for changes to take effect:
And validate newly installed extensions through the CLI:
FAQ
My build failed after changing the PHP version, why?
Versions of PHP 7.4 older than 7.4.13 will not compile on Mac as of magento-scripts 1.3.0.
Before changing the PHP version, make sure that it's supported by the Magento version you're using. By default, Create Magento App runs on Magento 2.4 that requires PHP of version 7.4.x. Please check the Magento 2.4 system requirements to see the list of supported PHP versions.
If the PHP version is correct and you have this issue, you should examine the build logs. Each failed build of Create Magento App supplies you with a build log and the location of that log is displayed at the end of the build:
My build failed after installing PHP extensions, why?
Some PHP extensions require certain binaries to be installed on your machine and the build will fail otherwise. The path to log file will be displayed in the console when the build fails:
You can print this log with tail
command to see the output:
In this case, the libmemcached
library is missing on the machine and has to be installed for build to succeed.
Known issue: magento-scripts on macOS cannot install gd extension on PHP 7.2
Link: https://github.com/scandipwa/create-magento-app/issues/80
You can fix this by adding:
Last updated