DEV Community

Cover image for 6 Ways to Deploy your Personal Websites / PHP+ MySQL Web Apps for Free

6 Ways to Deploy your Personal Websites / PHP+ MySQL Web Apps for Free

Joeylene on March 20, 2019

In this post, I'll share my experiences, instructions rather, in deploying your website/web apps in different free web hosts. However, this post w...
Collapse
 
berviantoleo profile image
Bervianto Leo Pratama

Hi, I suggest to change database credential in .env file or in heroku you can use ENV that heroku already provided it.

To make sure for secret things never in commit. To make sure another people also not doing commit credential in they code (especially for open source code).

Just for suggestion. :D

Btw, great content!

Collapse
 
jorenrui profile image
Joeylene

That's a great input! Thanks for the suggestion 😊 Tho the .env is often indicated in the .gitignore file (Yet it'll be nice to include that in the article regardless) So, I guess I'll check the env provided by Heroku

Collapse
 
berviantoleo profile image
Bervianto Leo Pratama

Yes, .env usually in .gitignore, my focus here to make anyone aware about their credential in their code. 😀

Thread Thread
 
jorenrui profile image
Joeylene • Edited

Ow I see 🤔 If you put it that way, then I'll add those steps regarding Heroku Config Vars. Thanks again for your suggestion!

Collapse
 
hackergaucho profile image
Hacker Gaucho • Edited

great article.

I just want to remember that it can be risky to use free hosting due to the danger of having the site blocked by both social networks and DNS services.

Twitter blocks Geocities.ws, CleanBrowsing blocks all 000webhost.com domains and subdomains.

#CleanBrowsing DNS test
dig www.000webhost.com @185.228.168.9
Enter fullscreen mode Exit fullscreen mode

this is difficult to avoid since it depends a lot on the free hosting service itself to have an efficient removal service and dangerous content.

Collapse
 
jorenrui profile image
Joeylene

Thank you for that info. I agree with what you said.

I also believe that using paid web hosts like Digital Ocean or AWS is by far better than using free web hosts. Tried it and was so amazed of the difference. I've added in a word in the article as to show that using 000webhost for long-term usage is not recommended since it comes with great security risks.

Nevertheless, I didn't left out 000webhost in the article since it can still be helpful for others like students who just need to deploy a web app as a project requirement for a couple of days free of charge. Since most of those who ask me are still beginners and don't know how to use Git yet. I tried searching for free web host and so far, Heroku is the best that I got when it comes to free PHP web hosting. Also, I've written this article when I was still a 4th year student searching for a free web app so most of my target audience are beginners in web deployment like me. So I just decided to write in more warnings in using 000webhost instead of removing it.

Tho as I gain more and more experience and knowledge as time goes by, I would rather use paid web hosts for my PHP web apps. 😀

Collapse
 
azazqadir profile image
Muhammad Azaz Qadir • Edited

Heroku is great, but I wouldn't recommend 000webhost. This type of free hosting is not a good option for PHP considering security vulnerabilities in PHP. There is a free tier of Amazon EC2 instance as well. But I suppose that would be too much for a personal website. You could also go with DigitalOcean. It is not that expensive. If you don't have sysadmin skills, then you can use one-click solutions for PHP MySQL web hosting available online.

Collapse
 
mohammedfoysal profile image
Mohammed Foysal

Be careful with 000webhostapp, they've been pwned. haveibeenpwned.com/PwnedWebsites#0...

Collapse
 
gusbemacbe profile image
Gustavo Costa

We are in 2019 and not in 2015. That has already been fixed.

Collapse
 
jorenrui profile image
Joeylene

Thanks for that notice. I'll include a warning in the post regarding that 😳

Collapse
 
andreasneuman profile image
andreasneuman

Great article with nice tips, thanks!
If to talk about MySQL deploy processes, I would like to add some information too. There is a nice tool - Compare Bundle for MySQL that helps to compare and synchronize data and schema, besides it is useful in devops processes
devart.com/dbforge/mysql/compare-b...

Collapse
 
sanscod profile image
Sans-cod • Edited

I tried out 000webhost to test a simple application. I have kept getting this message:

Warning: mysqli::__construct(): (HY000/1045): ProxySQL Error: Access denied for user 'root'@'2a02:4780:bad:f00d::e' (using password: NO) in /storage/ssd5/872/12840872/public_html/admin/includes/conn.php on line 2
Connection failed: ProxySQL Error: Access denied for user 'root'@'2a02:4780:bad:f00d::e' (using password: NO)

This is my connection code:
<?php
$conn = new mysqli('localhost', 'id12840872_root', 'Ejakait2#', 'id12840872_votesystem');

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

?>

Can someone help me figure out where I could be doing things wrong? The error appears when I try to log in online but the app works fine on localhost.

Collapse
 
saeedrajeh profile image
SaeedRajeh

follow this steps:
1- make sure db passowrd not contain * special character
2- make sure your db name and db username correct
3- Delete all files from /bootstrap/cache except .gitignore

good luck

Collapse
 
johnpaulada profile image
John Paul Ada

Nice article 😁! Got reminded of this section on the Create React App docs : Deployment

Collapse
 
jorenrui profile image
Joeylene

Thanks! Ow 👀 Haven't learned React yet. Gonna tackle that in the near future 😊

Collapse
 
johnpaulada profile image
John Paul Ada

These are just the deployment options. :D Hope to see you learn it and talk to the community about it :D

Thread Thread
 
jorenrui profile image
Joeylene

Ow I see. I'll try when I get there 😂😊

Collapse
 
sagarmaheshwary profile image
Sagar Maheshwary

Very helpful and detailed article. Many thanks!

Collapse
 
jorenrui profile image
Joeylene

Glad you liked it! 😊

Collapse
 
abdurrahmaanj profile image
Abdur-Rahmaan Janhangeer

pulling from private repos?

Collapse
 
jorenrui profile image
Joeylene

Yes, you can. Private repos will remain private even if the site deployed to the public 😊

Collapse
 
gusbemacbe profile image
Gustavo Costa

Using a private repository for GitHub Pages is not free, but for GitLab Pages, it is free.

Collapse
 
sr505505 profile image
sr505505

Thank you for your helpful post❤️💯

Collapse
 
fatimatariq25 profile image
Fatima Tariq

Very insightful and helpful article! Thanks for sharing it with the community.

Collapse
 
jorenrui profile image
Joeylene

You're welcome. Glad to help 😊

Collapse
 
jerry80409 profile image
jerry80409

I love this article, it helps me a lot :)

Collapse
 
jorenrui profile image
Joeylene

Thank you! I appreciate the love 🤗♥️

Collapse
 
yukiinoue profile image
Yuki Inoue

FWIW: firebase hosting is also a candidate for free static web sites.

Collapse
 
jorenrui profile image
Joeylene • Edited

Yes 😃 All dynamic web hosts like Heroku and 000webhost can also be used for static sites. I just didn't include it cause I haven't added how-to-do-it for those.

Though, I understand your point. To avoid confusion, I'll include it and update my post 😆

Collapse
 
horus_sky profile image
Cedric W

Great resource. Adding to my reading list.

Collapse
 
jorenrui profile image
Joeylene

Yey 😆✨

Collapse
 
mofe620 profile image
Mofe

This was so helpful. Thanks a lot! 😊

Collapse
 
jarvissilva profile image
Jarvis Silva

You can use vercel to host php for free with over 100gb of bandwidth for free here is complete tutorial on it: Host php on vercel

Collapse
 
bayuangora profile image
Bayu Angora

Any tutorial about how to build and deploy Hugo, Jekyll, Gatsby, Eleventy, etc, with Surge via mobile?

Collapse
 
jonathanmark profile image
Jonathan Maiztegui

good read!

been using heroku and gitlab for my porfolio for a while and I am currently searching for alternatives. Thank you for the heads up

Collapse
 
jorenrui profile image
Joeylene

You can also checkout Vercel for static sites.