GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
* Sign Up! *

Support
Customer Portal
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Web Applications: PHP and Deployment

bullet Introduction

Beyond static pages, your VPS can run full web applications — content management systems, forums, custom code. Most are written in PHP and backed by a database, so this page covers installing PHP, connecting it to Apache, adding a database, and the security habits that keep an application safe. It applies to both FreeBSD 15 and Rocky Linux 10. For a worked example, the WordPress page follows this exact path.

 

bullet Installing PHP

Install PHP, the FastCGI process manager (PHP-FPM), and the extensions your application needs — a database driver at minimum, plus common ones like gd, mbstring, xml, curl, and zip:

On FreeBSD 15:

# pkg install php84 php84-fpm php84-mysqli php84-pdo php84-gd php84-mbstring php84-curl php84-zip php84-opcache
# sysrc php_fpm_enable=YES
# service php-fpm start

On Rocky Linux 10:

# dnf install php php-fpm php-mysqlnd php-pdo php-gd php-mbstring php-xml php-curl php-zip php-opcache php-cli
# systemctl enable --now php-fpm

Apache then hands .php requests to PHP-FPM. The exact connector directive differs slightly between the systems; Apache's and PHP's documentation, and Webmin, can each set this up. Confirm PHP works by placing a small script that calls phpinfo() in your document root, loading it once, then deleting it.

 

bullet Adding a Database

Most applications need a database. Three options are packaged:

  • SQLite — a serverless, single-file database included with PHP's PDO extension; good for smaller sites, with nothing extra to install.

  • MariaDB — the recommended default, and what most applications document first.

  • MySQL — install this specifically when an application asks for Oracle's MySQL by name.

PostgreSQL is also available for applications that prefer it. Create a dedicated database and user for each application, as shown on the MariaDB page — never use the database's root account in an application's configuration.

 

bullet Deploying an Application

Most applications follow the same pattern: upload the files into your document root over SFTP (a secure client such as FileZilla works well) or fetch them with git clone; copy the sample configuration and fill in your database credentials; set ownership and permissions; then run the installer (often by visiting a URL). Files should be owned by you and readable by the web-server group; only the specific directories an application writes to (uploads, cache) need to be writable by the web server.

NOTE (Rocky Linux / SELinux): Beyond ownership and permissions, SELinux governs what Apache may do. Give writable directories the read-write web label, and grant network access if the app needs it:

# semanage fcontext -a -t httpd_sys_rw_content_t "/home/youruser/public_html/uploads(/.*)?"
# restorecon -Rv /home/youruser/public_html/uploads
# setsebool -P httpd_can_network_connect_db on     # connect to a database over TCP
# setsebool -P httpd_can_sendmail on               # let the app send mail

 

bullet A Security Checklist

An application exposed to the Internet is a target. The essentials:

  • Serve it over HTTPS, always.

  • Keep the application, its plugins/themes, and PHP itself updated; most compromises exploit known, already-patched bugs.

  • Use strong, unique passwords for the admin account and the database user.

  • Make as little as possible writable by the web server; keep configuration files out of the web-served tree where you can.

  • Back up files and database together — see Server Maintenance.

 

bullet Documentation


Toll Free 1-866-GSP-4400 • 1-301-464-9363 • service@gsp.com
Copyright © 1994-2026 GSP Services, Inc.