Create Magento App
Create ScandiPWA AppScandiPWA DocsGitHub
v1
v1
  • Create Magento App
  • Getting started
    • Getting Started
    • Prerequisites
      • Linux requirements
      • MacOS requirements
        • Apple Silicon
      • Windows requirements
    • Available commands
      • Start the application
      • Stop the application
      • Check application status
      • Enter application CLI
      • Explore application logs
      • Execute commands in Docker containers
      • Link a theme
      • Import database dump
      • ⚠️ Uninstall a project
    • Folder structure
    • Updating to New Releases
      • Testing Alpha Releases
    • Configuration File
    • Supported Magento versions
    • How does it work?
    • Limitations
  • Usage guide
    • Using console commands
    • Accessing Docker containers
    • Linking a Scandi Theme
    • Enabling XDebug
    • Enabling SSL
    • Configuring PHP
    • Use custom domain
    • Access on the local network
    • Importing database
      • Importing remote database
    • Using Enterprise Edition
    • Converting legacy Docker setup to CMA
    • Improve Performance
  • Scripts Extensions
    • PHP Extensions
      • ionCube Extension
  • Troubleshooting
    • Common Issues
    • CMA Debugging
    • Uninstall CMA
Powered by GitBook
On this page
  • Changing the PHP version
  • Installing PHP extensions
  • FAQ
  • My build failed after changing the PHP version, why?
  • My build failed after installing PHP extensions, why?
  • Known issue: magento-scripts on macOS cannot install gd extension on PHP 7.2
  1. Usage guide

Configuring PHP

PHP configuration is stored within the cma.js file:

module.exports = {
    magento: {
        first_name: 'Scandiweb',
        last_name: 'Developer',
        email: 'developer@scandipwa.com',
        user: 'admin',
        password: 'scandipwa123',
        adminuri: 'admin',
        mode: 'developer',
    },
    configuration: {
        php: {
            // PHP configuration goes here
        }
    }
};

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:

module.exports = {
    magento: {
        first_name: 'Scandiweb',
        last_name: 'Developer',
        email: 'developer@scandipwa.com',
        user: 'admin',
        password: 'scandipwa123',
        adminuri: 'admin',
        mode: 'developer',
    },
    configuration: {
        php: {
            version: '7.4.14'
        }
    }
};

After changing the configuration, restart the app to install the new PHP version:

yarn start

And validate the new PHP installation through the CLI:

yarn cli
bash-3.2$ php -v
PHP 7.4.14 (cli) (built: Mar 16 2021 16:21:11) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Xdebug v3.0.3, Copyright (c) 2002-2021, by Derick Rethans

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:

module.exports = {
    magento: {
        first_name: 'Scandiweb',
        last_name: 'Developer',
        email: 'developer@scandipwa.com',
        user: 'admin',
        password: 'scandipwa123',
        adminuri: 'admin',
        mode: 'developer',
    },
    configuration: {
        php: {
            extensions: {
                memcached: {},
                sphinx: {
                    version: '1.3.3'
                }
            }
        }
    }
};

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:

yarn start

And validate newly installed extensions through the CLI:

yarn cli
bash-3.2$ php -m | grep "memcached\|sphinx"
memcached
sphinx

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.

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:

Please checkout the build log file for more details:
	 tail /Users/user/.phpbrew/build/php-7.4.0/build.log
error Command failed with exit code 1.

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:

Log stored at: /Users/user/.phpbrew/build/php-7.4.13/ext/memcached/build.log

You can print this log with tail command to see the output:

checking for libmemcached location... configure: error: memcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located

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

You can fix this by adding:

configuration: {
    php: {
      extensions: {
        gd: {
          macosOptions: '--with-zlib-dir=$(brew --prefix zlib)'
        }
      }
    }
  }

PreviousEnabling SSLNextUse custom domain

Last updated 2 years ago

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 to see the list of supported PHP versions.

Link:

Magento 2.4 system requirements
https://github.com/scandipwa/create-magento-app/issues/80