Using PHP with Sandvox

Sandvox offers only some basic PHP support at present. For more information on what PHP is, please see

Adding PHP code to a Sandvox page or site is an advanced ability of Sandvox. Because of the extent of PHP and the many ways in which PHP can be incorporated into a Sandvox site, Karelia does not attempt to provide its own PHP tutorial, nor can it provide specific troubleshooting advice related to an individual user's PHP code.

If you would like to explore the possibilities that using PHP in your Sandvox site presents and need some assistance, we encourage you to visit the following third party sites that specifically address PHP issues:

PHP is heavily dependent upon the server running it. For any PHP code in your site to work, you must ensure that your Host is correctly set up to handle it. Note that Sandvox Hosting does not currently support PHP; other hosts may. (For example: A2 Hosting.) This article offers an idea of what can be achieved with PHP in Sandvox.

Note that Sandvox does not understand PHP code at all; there is no built-in PHP parser. While editing PHP code in Sandvox, pages may look a little strange, containing bits and pieces of the HTML embedded within the PHP. In order to see how the PHP will look, you will need to upload the site to its host, where the PHP can be processed. This is somewhat similar to if you opened an HTML & PHP file stored on your computer using Safari.

Your Host may require that any PHP pages have the extension "php" rather than "html" in order to process them. You can set the extension to "php" as appropriate. It may also be possible to configure your server to cause all HTML pages to be pre-processed with PHP.

If your PHP scripts require additional files and resources to function, you will need to upload and maintain these files separately from Sandvox.

There are two areas within Sandvox that are of interest for utilizing PHP code:


A Raw HTML object allows you to enter custom HTML code. If your Host supports it, you can include PHP code here as well.

In the HTML Editor's toolbar, set the "Content Type" to PHP.


Then a PHP placeholder will appear in the Web View where you Raw HTML object is: PHP_Placeholder.png

Code Injection

Sandvox provides a number of places custom code can be inserted. Before the <html> tag is particularly useful for PHP directives.

Keywords: php, script, scripts, server, host, code, phpbb

How can we improve this page? Let us know.