{"id":780,"date":"2025-07-21T14:09:03","date_gmt":"2025-07-21T08:39:03","guid":{"rendered":"https:\/\/www.webeyesoft.com\/blog\/docs\/tutorials\/how-to-upload-website-to-web-hosting\/"},"modified":"2025-07-21T14:20:46","modified_gmt":"2025-07-21T08:50:46","slug":"how-to-upload-website-to-web-hosting","status":"publish","type":"docs","link":"https:\/\/www.webeyesoft.com\/blog\/docs\/tutorials\/how-to-upload-website-to-web-hosting\/","title":{"rendered":"How to Upload Your PHP\/HTML Website with MySQL Database to Web Hosting"},"content":{"rendered":"<p data-start=\"233\" data-end=\"592\">If you have a PHP or HTML website, whether it uses a MySQL database or not, uploading it to your web hosting can seem a bit tricky if you\u2019re doing it for the first time. Don\u2019t worry \u2014 we\u2019ve got you covered! In this tutorial, we\u2019ll guide you through the process of uploading your website, setting up your MySQL database (if needed), and getting your site live.<\/p>\n<hr data-start=\"594\" data-end=\"597\" \/>\n<h3 data-start=\"599\" data-end=\"650\"><strong data-start=\"603\" data-end=\"650\">Step 1: Login to Your Hosting Control Panel<\/strong><\/h3>\n<p data-start=\"652\" data-end=\"811\">To start, you\u2019ll need to log in to your hosting control panel. This is typically <strong data-start=\"733\" data-end=\"743\">cPanel<\/strong> or another custom control panel depending on your hosting provider.<\/p>\n<ol data-start=\"813\" data-end=\"897\">\n<li data-start=\"813\" data-end=\"850\">\n<p data-start=\"816\" data-end=\"850\"><strong data-start=\"816\" data-end=\"849\">Login to your hosting account<\/strong>.<\/p>\n<\/li>\n<li data-start=\"851\" data-end=\"897\">\n<p data-start=\"854\" data-end=\"897\">Once logged in, go to the <strong data-start=\"880\" data-end=\"896\">File Manager<\/strong>.<\/p>\n<\/li>\n<\/ol>\n<hr data-start=\"899\" data-end=\"902\" \/>\n<h3 data-start=\"904\" data-end=\"952\"><strong data-start=\"908\" data-end=\"952\">Step 2: Open the <code data-start=\"927\" data-end=\"940\">public_html<\/code> Directory<\/strong><\/h3>\n<p data-start=\"954\" data-end=\"1128\">The <strong data-start=\"958\" data-end=\"975\"><code data-start=\"960\" data-end=\"973\">public_html<\/code><\/strong> directory is the root folder for your website. All of your website files will need to be uploaded here to make them publicly accessible on the internet.<\/p>\n<ol data-start=\"1130\" data-end=\"1264\">\n<li data-start=\"1130\" data-end=\"1260\">\n<p data-start=\"1133\" data-end=\"1260\">In <strong data-start=\"1136\" data-end=\"1152\">File Manager<\/strong>, locate and click on the <strong data-start=\"1178\" data-end=\"1195\"><code data-start=\"1180\" data-end=\"1193\">public_html<\/code><\/strong> folder. This is the directory where all website files should go.<\/p>\n<\/li>\n<\/ol>\n<hr data-start=\"1265\" data-end=\"1268\" \/>\n<h3 data-start=\"1270\" data-end=\"1311\"><strong data-start=\"1274\" data-end=\"1311\">Step 3: Upload Your Website Files<\/strong><\/h3>\n<p data-start=\"1313\" data-end=\"1518\">Now, let\u2019s upload the website files to the <strong data-start=\"1356\" data-end=\"1373\"><code data-start=\"1358\" data-end=\"1371\">public_html<\/code><\/strong> directory. You can upload your files either in a <strong data-start=\"1423\" data-end=\"1437\">zip format<\/strong> (which makes it easier to upload multiple files at once) or as individual files.<\/p>\n<h4 data-start=\"1520\" data-end=\"1556\">Option 1: <strong data-start=\"1535\" data-end=\"1556\">Upload a Zip File<\/strong><\/h4>\n<ol data-start=\"1558\" data-end=\"1912\">\n<li data-start=\"1558\" data-end=\"1609\">\n<p data-start=\"1561\" data-end=\"1609\">Click the <strong data-start=\"1571\" data-end=\"1581\">Upload<\/strong> button in <strong data-start=\"1592\" data-end=\"1608\">File Manager<\/strong>.<\/p>\n<\/li>\n<li data-start=\"1610\" data-end=\"1723\">\n<p data-start=\"1613\" data-end=\"1723\">Select the <strong data-start=\"1624\" data-end=\"1636\">zip file<\/strong> that contains your website files (including your HTML, PHP, images, and other assets).<\/p>\n<\/li>\n<li data-start=\"1724\" data-end=\"1828\">\n<p data-start=\"1727\" data-end=\"1828\">Once the file is uploaded, <strong data-start=\"1754\" data-end=\"1782\">right-click the zip file<\/strong> and select <strong data-start=\"1794\" data-end=\"1805\">Extract<\/strong> to unzip the contents.<\/p>\n<\/li>\n<li data-start=\"1829\" data-end=\"1912\">\n<p data-start=\"1832\" data-end=\"1912\">After extracting, <strong data-start=\"1850\" data-end=\"1882\">delete the original zip file<\/strong> to save space on your server.<\/p>\n<\/li>\n<\/ol>\n<h4 data-start=\"1914\" data-end=\"1954\">Option 2: <strong data-start=\"1929\" data-end=\"1954\">Upload Files Normally<\/strong><\/h4>\n<ol data-start=\"1956\" data-end=\"2065\">\n<li data-start=\"1956\" data-end=\"2065\">\n<p data-start=\"1959\" data-end=\"2065\">If you&#8217;re uploading individual files, you can simply drag and drop them into the <strong data-start=\"2040\" data-end=\"2057\"><code data-start=\"2042\" data-end=\"2055\">public_html<\/code><\/strong> folder.<\/p>\n<\/li>\n<\/ol>\n<hr data-start=\"2067\" data-end=\"2070\" \/>\n<h3 data-start=\"2072\" data-end=\"2147\"><strong data-start=\"2076\" data-end=\"2147\">Step 4: Database Connection Setup (If Your Website Uses a Database)<\/strong><\/h3>\n<p data-start=\"2149\" data-end=\"2463\">If your website uses a <strong data-start=\"2172\" data-end=\"2190\">MySQL database<\/strong> (common with PHP websites), you\u2019ll need to set up the database to connect your website with the correct data. If you see a <strong data-start=\"2314\" data-end=\"2343\">database connection error<\/strong> on your website, it means your website code is looking for a database, but it&#8217;s not yet set up. Here\u2019s how to fix that:<\/p>\n<ol data-start=\"2465\" data-end=\"2916\">\n<li data-start=\"2465\" data-end=\"2657\">\n<p data-start=\"2468\" data-end=\"2657\"><strong data-start=\"2468\" data-end=\"2494\">Find the database file<\/strong>: Look for a file in your website\u2019s root directory that might be named something like <strong data-start=\"2580\" data-end=\"2592\"><code data-start=\"2582\" data-end=\"2590\">db.sql<\/code><\/strong> or similar. This file contains your database structure and data.<\/p>\n<\/li>\n<li data-start=\"2659\" data-end=\"2916\">\n<p data-start=\"2662\" data-end=\"2916\"><strong data-start=\"2662\" data-end=\"2699\">Find the database connection file<\/strong>: Look for a PHP file responsible for connecting to the database. This file is often named <strong data-start=\"2790\" data-end=\"2806\"><code data-start=\"2792\" data-end=\"2804\">db-con.php<\/code><\/strong> or something similar. It contains information about your database&#8217;s <strong data-start=\"2875\" data-end=\"2883\">name<\/strong>, <strong data-start=\"2885\" data-end=\"2897\">username<\/strong>, and <strong data-start=\"2903\" data-end=\"2915\">password<\/strong>.<\/p>\n<\/li>\n<\/ol>\n<hr data-start=\"2918\" data-end=\"2921\" \/>\n<h3 data-start=\"2923\" data-end=\"2970\"><strong data-start=\"2927\" data-end=\"2970\">Step 5: Create a New Database in control panel\u00a0<\/strong><\/h3>\n<p data-start=\"2972\" data-end=\"3061\">Next, we need to create a MySQL database to connect to your website. Here\u2019s how to do it:<\/p>\n<ol data-start=\"3063\" data-end=\"3520\">\n<li data-start=\"3063\" data-end=\"3123\">\n<p data-start=\"3066\" data-end=\"3123\"><strong data-start=\"3066\" data-end=\"3087\">Go back to Control panel <\/strong>and find the <strong data-start=\"3101\" data-end=\"3114\">Databases<\/strong> section.<\/p>\n<\/li>\n<li data-start=\"3124\" data-end=\"3156\">\n<p data-start=\"3127\" data-end=\"3156\">Click on <strong data-start=\"3136\" data-end=\"3155\">MySQL Databases<\/strong>.<\/p>\n<\/li>\n<li data-start=\"3157\" data-end=\"3265\">\n<p data-start=\"3160\" data-end=\"3265\">In the <strong data-start=\"3167\" data-end=\"3190\">Create New Database<\/strong> section, enter a <strong data-start=\"3208\" data-end=\"3216\">name<\/strong> for your database and click <strong data-start=\"3245\" data-end=\"3264\">Create Database<\/strong>.<\/p>\n<\/li>\n<li data-start=\"3266\" data-end=\"3440\">\n<p data-start=\"3269\" data-end=\"3440\">After creating the database, <strong data-start=\"3298\" data-end=\"3328\">create a new database user<\/strong> with a <strong data-start=\"3336\" data-end=\"3348\">username<\/strong> and <strong data-start=\"3353\" data-end=\"3365\">password<\/strong>. Make sure to save this information, as you\u2019ll need it for the next steps.<\/p>\n<\/li>\n<li data-start=\"3441\" data-end=\"3520\">\n<p data-start=\"3444\" data-end=\"3520\">Add the new database user to the database and grant them <strong data-start=\"3501\" data-end=\"3519\">All Privileges<\/strong>.<\/p>\n<\/li>\n<\/ol>\n<hr data-start=\"3522\" data-end=\"3525\" \/>\n<h3 data-start=\"3527\" data-end=\"3578\"><strong data-start=\"3531\" data-end=\"3578\">Step 6: Import Your Database via phpMyAdmin<\/strong><\/h3>\n<p data-start=\"3580\" data-end=\"3718\">Now that your database is created, it\u2019s time to import the database structure and data (from the <strong data-start=\"3677\" data-end=\"3689\"><code data-start=\"3679\" data-end=\"3687\">db.sql<\/code><\/strong> file) into the new database.<\/p>\n<ol data-start=\"3720\" data-end=\"4152\">\n<li data-start=\"3720\" data-end=\"3806\">\n<p data-start=\"3723\" data-end=\"3806\"><strong data-start=\"3723\" data-end=\"3744\">Go back to Control panel <\/strong>and find the <strong data-start=\"3758\" data-end=\"3772\">phpMyAdmin<\/strong> icon under the Databases section.<\/p>\n<\/li>\n<li data-start=\"3807\" data-end=\"3890\">\n<p data-start=\"3810\" data-end=\"3890\">Open <strong data-start=\"3815\" data-end=\"3829\">phpMyAdmin<\/strong> and select the newly created database from the left sidebar.<\/p>\n<\/li>\n<li data-start=\"3891\" data-end=\"3933\">\n<p data-start=\"3894\" data-end=\"3933\">Click on the <strong data-start=\"3907\" data-end=\"3917\">Import<\/strong> tab at the top.<\/p>\n<\/li>\n<li data-start=\"3934\" data-end=\"4040\">\n<p data-start=\"3937\" data-end=\"4040\">In the <strong data-start=\"3944\" data-end=\"3962\">File to Import<\/strong> section, select your <strong data-start=\"3984\" data-end=\"3996\"><code data-start=\"3986\" data-end=\"3994\">db.sql<\/code><\/strong> file (the database file you found earlier).<\/p>\n<\/li>\n<li data-start=\"4041\" data-end=\"4152\">\n<p data-start=\"4044\" data-end=\"4152\">Click <strong data-start=\"4050\" data-end=\"4056\">Go<\/strong> to start the import process. This will import the tables and data into your new MySQL database.<\/p>\n<\/li>\n<\/ol>\n<hr data-start=\"4154\" data-end=\"4157\" \/>\n<h3 data-start=\"4159\" data-end=\"4210\"><strong data-start=\"4163\" data-end=\"4210\">Step 7: Update the Database Connection File<\/strong><\/h3>\n<p data-start=\"4212\" data-end=\"4352\">Now, you need to update the database connection information in your website\u2019s code so it can connect to the new database you\u2019ve just set up.<\/p>\n<ol data-start=\"4354\" data-end=\"4861\">\n<li data-start=\"4354\" data-end=\"4481\">\n<p data-start=\"4357\" data-end=\"4481\">Go back to <strong data-start=\"4368\" data-end=\"4384\">File Manager<\/strong> and locate the database connection file (typically named <strong data-start=\"4442\" data-end=\"4458\"><code data-start=\"4444\" data-end=\"4456\">db-con.php<\/code><\/strong> or something similar).<\/p>\n<\/li>\n<li data-start=\"4482\" data-end=\"4534\">\n<p data-start=\"4485\" data-end=\"4534\">Right-click and select <strong data-start=\"4508\" data-end=\"4516\">Edit<\/strong> to open the file.<\/p>\n<\/li>\n<li data-start=\"4535\" data-end=\"4814\">\n<p data-start=\"4538\" data-end=\"4612\">Update the following parameters in the code with the new database details:<\/p>\n<ul data-start=\"4616\" data-end=\"4814\">\n<li data-start=\"4616\" data-end=\"4685\">\n<p data-start=\"4618\" data-end=\"4685\"><strong data-start=\"4618\" data-end=\"4635\">Database name<\/strong>: Enter the name of the database you just created.<\/p>\n<\/li>\n<li data-start=\"4689\" data-end=\"4753\">\n<p data-start=\"4691\" data-end=\"4753\"><strong data-start=\"4691\" data-end=\"4703\">Username<\/strong>: Enter the username you created for the database.<\/p>\n<\/li>\n<li data-start=\"4757\" data-end=\"4814\">\n<p data-start=\"4759\" data-end=\"4814\"><strong data-start=\"4759\" data-end=\"4771\">Password<\/strong>: Enter the password for the database user.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li data-start=\"4815\" data-end=\"4861\">\n<p data-start=\"4818\" data-end=\"4861\"><strong data-start=\"4818\" data-end=\"4826\">Save<\/strong> the file after making the changes.<\/p>\n<\/li>\n<\/ol>\n<hr data-start=\"4863\" data-end=\"4866\" \/>\n<h3 data-start=\"4868\" data-end=\"4902\"><strong data-start=\"4872\" data-end=\"4902\">Step 8: Check Your Website<\/strong><\/h3>\n<p data-start=\"4904\" data-end=\"4970\">Now that everything is set up, you\u2019re ready to check your website:<\/p>\n<ol data-start=\"4972\" data-end=\"5156\">\n<li data-start=\"4972\" data-end=\"5058\">\n<p data-start=\"4975\" data-end=\"5058\"><strong data-start=\"4975\" data-end=\"4996\">Open your browser<\/strong> and type in your domain name (e.g., <strong data-start=\"5033\" data-end=\"5056\"><a class=\"cursor-pointer\" target=\"_new\" rel=\"noopener\" data-start=\"5035\" data-end=\"5054\">www.yourwebsite.com<\/a><\/strong>).<\/p>\n<\/li>\n<li data-start=\"5059\" data-end=\"5156\">\n<p data-start=\"5062\" data-end=\"5156\">If everything is connected correctly, your website should load and display without any issues.<\/p>\n<\/li>\n<\/ol>\n<p data-start=\"5158\" data-end=\"5300\">If you&#8217;re still encountering any issues, double-check your database connection details and ensure the <strong data-start=\"5260\" data-end=\"5272\"><code data-start=\"5262\" data-end=\"5270\">db.sql<\/code><\/strong> file was properly imported.<\/p>\n<hr data-start=\"5302\" data-end=\"5305\" \/>\n<h3 data-start=\"5307\" data-end=\"5325\"><strong data-start=\"5311\" data-end=\"5325\">Conclusion<\/strong><\/h3>\n<p data-start=\"5327\" data-end=\"5553\">That\u2019s it! You\u2019ve successfully uploaded your PHP\/HTML website with or without a MySQL database to your hosting server. Whether you\u2019ve uploaded a static site or a dynamic one, your site should now be live and working perfectly.<\/p>\n<p data-start=\"5555\" data-end=\"5675\">If you\u2019re still having trouble or encounter errors, don\u2019t hesitate to leave a comment below, and we\u2019ll be happy to help!<\/p>\n","protected":false},"featured_media":0,"parent":502,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-780","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/www.webeyesoft.com\/blog\/wp-json\/wp\/v2\/docs\/780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webeyesoft.com\/blog\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.webeyesoft.com\/blog\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webeyesoft.com\/blog\/wp-json\/wp\/v2\/comments?post=780"}],"version-history":[{"count":3,"href":"https:\/\/www.webeyesoft.com\/blog\/wp-json\/wp\/v2\/docs\/780\/revisions"}],"predecessor-version":[{"id":783,"href":"https:\/\/www.webeyesoft.com\/blog\/wp-json\/wp\/v2\/docs\/780\/revisions\/783"}],"up":[{"embeddable":true,"href":"https:\/\/www.webeyesoft.com\/blog\/wp-json\/wp\/v2\/docs\/502"}],"prev":[{"title":"How to transfer your domain to another domain provider.","link":"https:\/\/www.webeyesoft.com\/blog\/docs\/tutorials\/how-to-transfer-your-domain-to-another-domain-provider\/","href":"https:\/\/www.webeyesoft.com\/blog\/wp-json\/wp\/v2\/docs\/654"}],"wp:attachment":[{"href":"https:\/\/www.webeyesoft.com\/blog\/wp-json\/wp\/v2\/media?parent=780"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.webeyesoft.com\/blog\/wp-json\/wp\/v2\/doc_tag?post=780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}