Spectivis Cloud
PHP
PHP sites on Spectivis Cloud
How Cloud runs a plain PHP site, including the web root, pretty URLs, extensions and PHP versions.
The PHP framework runs a plain PHP site: one with an index.php, with or without composer.json, in the top folder or in a folder such as public. Laravel, WordPress and Magento have their own frameworks.
Uploaded files run live
Section titled “Uploaded files run live”A PHP app made from uploaded files is a live site: it runs straight from your files, every folder is writable, and a change is live at once. Nothing is installed for you, so upload vendor with the site or run composer install in the Terminal. The rest of this page also describes PHP apps built from a repository, where the code is read-only and only the folders you list are kept.
Defaults
Section titled “Defaults”| Setting | Default |
|---|---|
| Web server | FrankenPHP for PHP 8.2 and newer. PHP 7.4, 8.0 and 8.1 run on PHP-FPM. |
| Web root | public when it has an index.php, otherwise the top folder. Change it in Settings, Build and deploy. |
| Health path | / |
| Size | 512 MB |
Web root
Section titled “Web root”If the web root you set has no index.php or index.html, but exactly one other folder has one, the build serves that folder and the build log says so. Set the web root in Settings to make it permanent. If several folders have one, the build stops and names them, so you can pick.
Pretty URLs and .htaccess
Section titled “Pretty URLs and .htaccess”Cloud does not run Apache, so .htaccess files are not read. A request for a file that does not exist goes to the web root’s index.php, which is what most .htaccess rewrite rules do. Your code can read the original path from $_SERVER['REQUEST_URI']. Rules that do something else, such as redirects or password protection, need to move into your code or into the firewall and redirects.
PHP extensions
Section titled “PHP extensions”Every PHP app gets bcmath, exif, gd, intl, opcache, soap and zip, on top of PHP’s usual ones (curl, mbstring, openssl, xml and more). When the environment has a database it also gets mysqli and pdo_mysql. This works with or without composer.json.
For anything else, such as imagick or redis, list it in the RAILPACK_PHP_EXTENSIONS variable, separated by commas, or require it in composer.json (for example "ext-imagick": "*"). Deploy again to install it.
PHP’s mail() cannot send from Cloud. It returns false, and the app’s logs say why. Send mail through an SMTP service instead. See Sending mail.
PHP version
Section titled “PHP version”Pick one in Settings, Build and deploy. 8.2 and newer are labelled FrankenPHP. 7.4, 8.0 and 8.1 are labelled “PHP-FPM, past end of life”: they get no security fixes and are there for old sites. See WordPress for how automatic works.
The version you pick wins over the "php" requirement in composer.json. On automatic, a requirement such as >=7.4 that the build cannot match to a version runs on PHP 8.4, and the build log says so. Composer still checks your requirement against it. If the build cannot plan the app at all, the deploy says why.
WordPress in a PHP app
Section titled “WordPress in a PHP app”If WordPress is in your web root, the Overview has the one-click Open admin button. The WordPress framework does more for you: it writes wp-config.php, keeps wp-content and adds WordPress core. See WordPress.
A Magento store in a PHP app
Section titled “A Magento store in a PHP app”The PHP framework cannot run Magento 2, so the build stops and says so. Press Use Magento settings in Settings, Build and deploy, then deploy again. It switches the app to the Magento framework and keeps the folders and processes you added. It also adds what Magento needs: a database, OpenSearch, the pub web root, Magento’s kept folders and cron. Magento needs at least 2 GB of memory and PHP 8.2 or newer.
A home page that fails
Section titled “A home page that fails”After the health path passes, Cloud also opens your home page. If it answers with a server error (500 to 599) three times, the new version does not go live, the previous one keeps serving, and the deploy says why. Check the app’s logs for the error.