move from local xampp server to online server

2019-06-26 07:47发布

问题:

I wrote an android app and for development, I used a local XAMPP server. On the server side I use a mysql db and a few php files that contain the queries. On the android side, I use HttpURLConnection as shown below

url = new URL(AppHelper.SERVER_URL + phpFile);
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestMethod("POST");

request = new OutputStreamWriter(connection.getOutputStream());
request.write(parameters);
request.flush();
request.close();
String line = "";
InputStreamReader isr = new InputStreamReader(connection.getInputStream());
BufferedReader reader = new BufferedReader(isr);
StringBuilder sb = new StringBuilder();

Now I am at a stage where I would like some friends try out the app, so I want to set up a hosted webserver. Now I am hoping to get suggestions which service to use so that I can salvage and recycle most of my code and files. Please note that I am very unfamiliar with this, so user-friendliness is an important criteria. What are the preferred ways of moving from a local server to a hosted server solution?

回答1:

You can use heroku for hosting your serverside app. You Just only have to follow the tutorials from heroku and you will get your serverside webservice running in minutes and get URL for your server side webservice.

here is documentation for heroku.

You can also use openshift alternatively.

As for me Heroku works well.



回答2:

You can use any web hosting site, sign up there. and upload your all php files on that server. Create MySQL Database and create all necessary tables on Server.

Use Filezilla for syncing PHP files from server to local or vice-versa.



回答3:

You can use any shared server to host your PHP server side code and then it can be used with the android application (Don't forget to change the URL in you android application after hosting you PHP code in to server),as @WinHtalkAung you can use heroku to host your server code, you can also try this Fortrabbit, pagodabox, 000webhost

this links are providing free hosting for trail, check before using, and also check this link you may get a idea Some more



回答4:

You have several options depending on how big is the scale of your application,for example few PHP pages , no framework ,no need for CLI access and small database i'd go for cheap shared hosting since you are still prototyping it.

But as your application gets bigger and bigger your requirements for hosting will change from shared hosting probably to VPS or Heroku.

Personally I'd go for VPS for more flexibility and remember using Git will make it easier during development for deploying repeatedly after fixing bugs and making changes

Heart Internet UK have reasonable prices I think and this article is useful reading comparing Heroku to other options



回答5:

Initially host your code in a git repository provided by github or bitbucket(1-5users) for free of cost. Then try to deploy your app using heroku or other deployment tools on hosted sites offered by many service providers reviewed and listed here .

Otherwise go for rackspace, digital ocean or aws for deploying app on custom environment as like setting up your local environment.



回答6:

Simple & Direct

  1. Select and signup at any hosting service that supports php and mysql (almost all of them support these) top ones being rackspace and digital ocean
  2. Move your files to their server by FTP.

Congratulations your application is up and running!!



回答7:

So you want to test your app with FEW friends right?? There is a app called ngrok which allows you to forward your localhost:#### port to one of its online held ports and your friends can use the link to indirectly access your local machine.

SO if your friends find some bugs that can be fixed by few simple lines of code you can do that in your local machine and you are ready to go. NO GIT PUSHES ,NO Filezilla messes nothing.. This is a viable test option for you if u are planing to stick with only few friends and check the user acceptance testing NOT for actual deployment.