0

I wrote a simple user registration system that runs on my local machine using apache. (Localhost at port 8080).

My php file that tries to connect to mysql database looks like :

<?php

$con = mysqli_connect("localhost","root","","register");
//localhost will have to change to host name if hosted on different server... I think.

// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
?>

Everything works and I can register/sign in a user on my local machine.

I know that I have to change $con = mysqli_connect("localhost","root","","register"); once I am ready to upload my site to host it in a free server like surge.sh or github pages.

I pushed my site to github pages from my repository and when I click "Register" / "Sign in" it doesn't load the page instead it acts as if I want to download the .php file. How should I make the changes? I need some help and suggestions.

  • surge.sh homepage says `Static web publishing` - static means HTML, JS, CSS - not PHP. Similarly Github will host your projects, [but it won't execute them](http://stackoverflow.com/questions/10837946/how-to-publish-php-page-instead-of-html-at-github-to-demo-some-php-content). You need a web host, with PHP and MySQL, like Linode, Digial Ocean, GoDaddy, whatever takes your fancy. – Don't Panic Feb 11 '17 at 11:23
  • Thank you, I didn't know that. – elegantcomplexity Feb 14 '17 at 10:37

0 Answers0