# PHP applications

> Deploy plain PHP applications with custom document root configuration.

Plain PHP applications
-----------------------

The PHP application type allows you to deploy any PHP-based application that doesn't fit into the pre-configured frameworks like Laravel, WordPress, or Statamic. This is perfect for custom PHP applications, legacy systems, or any PHP project with its own structure.

When to use PHP application type
---------------------------------

Choose the PHP application type when deploying:

- Custom PHP applications without a specific framework
- Legacy PHP systems
- Simple PHP websites
- PHP applications with custom structures
- Projects where the index.php file is in a custom location

Creating a PHP application
--------------------------

1. Click "Create application" from your team dashboard
2. Select "PHP" as the application type
3. Choose your PHP version (8.5, 8.4, 8.3, 8.2, or 8.1)
4. Configure the document root path (see below)
5. Connect your Git repository
6. Review and create your application

Document root configuration
---------------------------

The document root path tells the web server where to find your application's entry point (typically index.php). This path is relative to `/var/www/html` where your code is deployed.

### Setting the document root

During application creation or in the Settings tab, you can specify the document root path:

- **Default**: `/` - The root directory contains your index.php
- **Custom path**: Any subdirectory like `/public`, `/www`, or `/web`

Build configuration
-------------------

### Default build commands

PHP applications automatically get the following default build command:

```bash
composer install --no-dev --optimize-autoloader
```

If you do not use composer you can remove this build command.

### Custom build commands

You can customize build commands in the Settings tab. Common examples:

- Installing npm packages: `npm ci && npm run build`
- Running custom scripts: `php scripts/build.php`
- Combining multiple steps: Multiple commands are executed in order

### PHP extensions

The following PHP extensions are enabled by default:

- zip
- intl
- mbstring
- xml
- bcmath

Additional extensions can be enabled in the Settings tab.
