Official Knowledgebase

Security & Deployment

cPanel & VPS setup, SSL certificates, HTTPS redirects, and directory permissions.

← Back to all categories

Security & Deployment

3 articles found
Security & Deployment

How to Deploy Any Script on cPanel or VPS Server →

Deploying your downloaded PHP scripts on a shared cPanel hosting account or a dedicated Linux VPS is straightforward when following these standardized steps. 1. Upload & Extract Files Access your hosting control panel (cPanel, DirectAdmin, or Plesk) or connect via SFTP: Navigate to your document root (usually public_html or a subfolder if setting up a sub-domain). Upload the downloaded project archive and extract it. Ensure files are directly placed inside your web root so that index.php sits in the root path. 2. Create a MySQL Database & User Open MySQL Databases in your hosting panel. Create a new database (e.g. u123_marketplace). Create a new database user with a strong password. Associate the user with the database and grant ALL PRIVILEGES. 3. Import the SQL Schema Open phpMyAdmin from your control panel. Select your newly created database from the left sidebar. Click on the Import tab at the top. Choose the database.sql file included with your download and click Go / Import. 4. Configure Database Credentials Locate the configuration file (usually config/config.php or .env) and update: DB_HOST: localhost (or your database server IP) DB_NAME: Your database name DB_USER: Your database username DB_PASS: Your database user password BASE_URL: https://yourdomain.com 5. Verify PHP Version Make sure your hosting PHP version is set to PHP 8.0, 8.1, or 8.2 with pdo_mysql, curl, zip, and fileinfo enabled.

Security & Deployment

SSL Certificate, HTTPS Redirect, and Cloudflare Setup →

Enforcing SSL/TLS encryption ensures all user logins, payment proof submissions, and download tokens are protected against eavesdropping. 1. Install Free SSL Certificate In cPanel, open SSL/TLS Status and run AutoSSL (Free Sectigo / Let's Encrypt). Wait 2-5 minutes until all domain records display green padlock icons. 2. Automatic HTTPS Redirect (.htaccess) Add these rules to the very top of your .htaccess file to automatically redirect all HTTP traffic to HTTPS: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 3. Cloudflare Configuration Tips If using Cloudflare DNS: Set Cloudflare SSL/TLS encryption mode to Full or Full (Strict). Never leave it on "Flexible" as this causes infinite redirect loops. Enable Always Use HTTPS and Automatic HTTPS Rewrites in the Cloudflare Edge Certificates tab. Set Security Level to Medium or enable "Under Attack Mode" if encountering DDoS attempts.

Security & Deployment

Recommended File Permissions (755 & 644) for Script Security →

Proper file and folder permissions are essential to prevent unauthorized scripts from modifying your source code or executing malicious binaries. 1. Standard Linux Permissions Directories: Set to 755 (rwxr-xr-x). Allows the web server and owner to read, write, and execute directories. Files: Set to 644 (rw-r--r--). Allows owner read/write and public read-only access. Configuration Files: Sensitive files like config/config.php can be set to 640 or 600 if your hosting environment permits. 2. Securing the Uploads Directory User-uploaded files (such as payment receipts, avatars, and thumbnails) reside in uploads/. To prevent PHP execution inside uploads: Ensure an .htaccess file exists inside uploads/ containing: <FilesMatch "\.(php|php5|php7|php8|phtml|pl|py|cgi)$"> Order Deny,Allow Deny from all </FilesMatch> This guarantees that even if a malicious file is uploaded, the web server refuses to execute it.