A PHP site profile on a small plan
Bothosting’s PHP site profile serves PHP from a dedicated web runtime with a public document root and an HTTPS address. A small PHP site, contact form or simple CMS fits Spark’s 256 MB RAM and 512 MB storage for free, renewed every 7 days. Paid plans start at $2.25 a month, skip renewals. A free Spark site can connect your own domain too.
Keep private files out of the web root
public/
index.php
contact.php
style.css
src/
mailer.php
config.phpOnly public/ is served. Keep config.php, includes and anything holding credentials beside it, and load them with a path such as __DIR__ . '/../config.php'. Put passwords and API keys in Variables and read them with getenv().
Publish and test
- Choose PHP site under website hosting. Upload the project, or start from the PHP example.
- Set
MAIN_FILEtopublic/index.phpand start the deployment. - Open the HTTPS address from Settings. Request a second page directly to check that routing works.
Domains, databases and when PHP is not needed
Add a CNAME and a TXT record to connect a hostname such as www.example.com. Free Spark sites can use a custom domain too. See HTTPS and custom domains. For data, a MySQL deployment can share the same account plan. If your site has no server-side code, a static site is lighter. See PHP or static hosting.