Run PHP on your website

Select the PHP version, upload your scripts to wwwroot and check the configuration with phpinfo().

PHP is a scripting language for building dynamic websites and web applications. To run it on your website you select a PHP version in the Control Panel and upload your scripts into /wwwroot.

Select the PHP version

  1. Open Scripting

    Sign in to the Control Panel, go to Websites, select your website and choose Scripting in the left menu.

  2. Choose the version

    In the PHP card select the version in the PHP Version list.

  3. Save

    Click Save. Changing the version restarts the PHP processes of the website.

The PHP card on the Scripting page

Note

If the PHP card says PHP is not available, PHP is not enabled for your account. See Choose the .NET and PHP version.

Upload your scripts

All PHP files must be located in /wwwroot, the root directory of your website. You can deploy them in several ways:

Method Speed
Web Deploy from the command line Fastest
ZIP archive uploaded and extracted on the server Fast
FTP / SFTP with FileZilla Slower

For a few files the simplest way is WebFTP: open webftp.monsterasp.net (or click Open next to WebFTP on the Deploy page, which signs you in automatically) and upload the files into wwwroot.

Test it

To check that PHP works and to see its configuration, upload a file named info.php into /wwwroot with this content:

<?php
phpinfo();
?>

Then open it in your browser, for example http://yourdomain.com/info.php. The page lists the PHP version, the loaded modules and all configuration values.

Tip

You can see the same information without uploading anything: click Show phpinfo() in the PHP card on the Scripting page.

Disabled functions

For security reasons exec() and the related process functions (shell_exec(), system(), passthru(), proc_open(), popen()) as well as symlink() are disabled on our shared hosting. They cannot be enabled for individual websites.

This means your scripts cannot start external programs or create symbolic links. Frameworks that rely on them for a single step usually offer a configuration alternative. For example, Laravel's php artisan storage:link needs exec() on Windows, but the public disk can be pointed directly to public/storage instead. See File storage without storage:link.

PostgreSQL: use emulated prepared statements

Our PostgreSQL servers are reached through a connection pooler running in transaction pooling mode. By default the pdo_pgsql driver uses server-side prepared statements and releases them with a plain DEALLOCATE pdo_stmt_N command. The pooler stores prepared statements under its own names, so PostgreSQL answers prepared statement does not exist. PDO ignores this reply, but inside a transaction it leaves the transaction aborted and the next query fails with:

SQLSTATE[25P02]: In failed sql transaction: current transaction is aborted, commands ignored until end of transaction block

The fix is to turn on emulated prepared statements for every pdo_pgsql connection:

$pdo = new PDO('pgsql:host=<local server name>;port=5432;dbname=dbXXXX', 'dbXXXX', 'your-password', [
    PDO::ATTR_EMULATE_PREPARES => true,
]);

With this option PDO builds the final SQL on the client side and no PREPARE / DEALLOCATE commands are sent to the server. The setting applies to any PHP application that connects to our PostgreSQL databases, including frameworks that use PDO internally. For Laravel see PostgreSQL connection.

Still stuck? Our support team is happy to help.
Ask the community Open a support ticket