Skip to main content

Managing and deploying PHP applications

Starting a PHP application

To start a PHP application from the mStudio, follow these steps:

  1. Navigate to the project that you want to create the application in.
  2. Select the "Apps" menu item in the sidebar.
  3. Click the "Create App" button and select "Custom PHP app".

After the installation has completed, observe the installation directory in the UI.

Deploying your app

Deploying your code

After you have created your PHP app, you can deploy your code by moving it into the designated application directory. You may use any method that you prefer to deploy your code, such as a local Git clone, rsync or SFTP.

Have a look at our collection of deployment guides for more information on how to deploy your code.

Managing OPCache

PHP comes with a built-in opcode cache called OPCache. OPCache is enabled by default, and will cache the compiled PHP code in memory to improve performance. Depending on your configuration, it may take a while for the cache to be updated when you deploy new code.

To force a refresh of the OPCache (for example, after a deployment), you can use tools like CacheTool to connect to the PHP-FPM socket and clear the cache (refer to CacheTool's installation instructions for more information on how to install it). For example, you can run the following command to clear the PHP OPCache:

$ php ./cachetool.phar opcache:reset --fcgi=127.0.0.1:9000

Customizing your PHP configuration

For the entire project

To customize your PHP configuration for the entire project, you can make changes to the ~/.config/php/php.ini file, or add a new .ini file to the ~/.config/php/php.d directory. Changes to these files will be detected automatically, and the PHP-FPM service will be restarted.

Per directory

To customize your PHP configuration for a specific directory, create a .user.ini file in that directory.1 This file will be parsed by PHP and will override the default configuration.

Footnotes

  1. https://www.php.net/manual/en/configuration.file.per-user.php