Build a PHP Website in cPanel: Files and Document Root
Drucken- PHP, cPanel
- 0
A PHP website is a set of files that the web server runs when a visitor opens a page. In cPanel, the folder connected to a domain is its document root. Uploading files to the wrong folder can leave the site showing a default page or a 404 error.
1. Find the domain's document root
Sign in to the correct hosting account and open File Manager. For the main domain, the document root is commonly public_html. Additional domains may use a separate folder. Check the Domains interface or your welcome information before uploading, especially when one account hosts multiple sites.
2. Upload the PHP files
Upload the site files into the document root for the domain. Keep the application's directory structure intact. If you use File Manager, select the site's archive and extract it into the intended folder; check that the main files are not nested one folder deeper than expected.
3. Check the default page
The home page is usually named index.php or index.html. Place it in the document root. If neither file exists, or if the only index file is inside a subfolder, the domain may show a directory listing or an error instead of your site.
4. Configure the application safely
Some PHP sites need a database and application settings. Use the software's current documentation to create the database and configure the connection. Do not put passwords or API keys in public text, screenshots, or support messages. Make a backup before changing configuration files.
5. Test the domain
Open the site over HTTPS and test its main pages, forms, and any database-backed features. If the domain is new or you recently changed DNS, allow time for cached records to update and confirm the domain points to the correct hosting account.
If the site does not load
- Confirm you uploaded files to the document root for the domain you are testing.
- Check that an index file exists in that folder.
- Review the application's error log without exposing sensitive details.
- Contact support with the domain, approximate time, and exact error message if the issue appears account- or server-related.
For control-panel access, see How to log in to cPanel. Compare current shared hosting plans for the domains and resources you need.
