banner



How To Upload Php And Mysql From Localhost To Existing Web Site

migrate php

Image Credits: Dribble

This is your website hosted on a shared web server. Let'southward wait and read the commodity until its completely loaded 😀

If you haven't migrated PHP and MySQL to cloud hosting and your website has recently experienced an set on on a shared hosting provider then you are the right person to read this article. Shared hosting sometimes creates a lot of hassles that y'all can't bear while running your online businesses. The situation may turn for the worse when you lot don't get proper support and go rid of the shit on time to suffer losses to your business.

The hosting service provider is the backbone of your online application(s) and website(s) considering your online presence is 100% dependent on them.

In most cases, web hosting for PHP depends largely on the PHP-based platform which is a scripting language – which for the past twenty years – is powering approx eighty% of the websites on dissimilar PHP frameworks like Laravel, Symfony, Codeigniter, and Yii. And then, don't recall PHP will die presently, or at least until 35 million websites die or convert to whatever other platform.

In this article, I'll elaborate on shared hosting problems and how y'all tin drift PHP and MySQL website to deject servers.

Without much ado, let'due south begin.

  1. Shared Hosting: An Informal Intro
  2. Horrors of shared hosting
    1. Less Security
    2. No Customization
    3. Flexibility
    4. Reanimation & Crashes
  3. Your Websites Deserves Better Home
  4. What is Cloudways? Haven't heard!
  5. Backup Your Complete Website
  6. PHP Migration on Cloudways
  7. Using FTP in Filezilla
  8. MySQL Migration
  9. Test On Staging URL
  10. Essential Settings for PHP App
  11. Enable Gratuitous SSL certificates (HTTPS Redirect)
  12. Pingdom Test
  13. Apache Criterion Test
  14. Expect out for PHP versions at Cloudways
  15. Migrate PHP To New Versions
  16. PHP Migration Tools
  17. Final Words

Shared means distributed resources under i roof, hence, shared hosting provides a set of resources to host multiple PHP websites on one server which is a more than economical solution for low budget websites. These small business websites do non tend to scale big plenty before long, albeit using dynamic external resource. The typical anatomy of shared hosting is like:

shared hosting

Every bit the prototype suggests, in shared hosting, a server typically stores multiple client websites thus sharing the resource. The server is responsible for managing all websites every bit. You will likewise get the database with PHPmyadmin client for working purposes, coupled with a lot of features like DNS mapping, security, SSL, backups, etc.

So what's the bad nearly shared hosting? If I delve deeper into details, I will say what'due south horrible nearly shared hosting? Lots of the things literally, Let's hash out what's bad about shared hosting.

Horrors of Shared Hosting

Your website is running well on a shared server, people are enjoying the content and yous are getting enough online sales to stay active in the business.

At present imagine! You lot check the website and all of a sudden your website nowhere. Information technology'southward gone, and yous don't know the reason. The screen is showing the sweet 500 server error :D. What will y'all do now? Check log? Create back up tickets? Head over to the conversation agents and spend hours with them to discover the downtime effect? There are countless steps you tin can take, but you don't know where to begin.

You Might Besides Like: Pitfalls of Laravel Shared Hosting for Your Projects

In the following paragraphs, I will discuss briefly the horrors of shared hosting.

Less Security

Shared hosting security is a myth. The website is seriously insecure and hackers can hack it easily if whatsoever asset of the website(s) gets affected in the pool. You can't easily salve information technology from DDoS attack or virus attacks.

No Customization

If you want to tweak your server needs and customize any internal settings of Apache, MySQL, or Redis, yous just tin't, hence you are unable to set solid rules to save your website.

Flexibility

Frequently developers demand to work with 3rd party APIs and packages which also require some core settings to integrate into the application. Late responses or poor speed tin also touch on the website because performance is relatively ho-hum on shared servers.

Reanimation & Crashes

Downtime and crashes hurt big time, merely the issues are prevalent in shared hosting. The shared servers can easily spread over and can negatively impact multiple websites. Y'all volition feel the malware bug often coming up, and your website will crash multiple times during a twenty-four hour period.

This is my stance, to which yous tin disagree. Community reviews provide a good resource to show you all. Let's come across what they remember virtually shared hosting:

Your Websites Deserves Ameliorate Domicile

Being an bureau, a developer, or an online business concern owner, you don't desire to face the above-mentioned hassles and will want to have a smooth hosting solution that can ensure availability and uptime 24/7. Don't worry though. At that place is a solution for all the website hosting issues you face. You tin opt for cloud servers like Digitalocean, Vultr, Linode, and Amazon Lightsail to keep your website running all the year-round.

I e'er recommend going for these options instead of shared hosting servers because the upkeep is similar and you tend to get highly optimized instances.

These deject servers are far better, and provide the post-obit features to benefit you:

  1. Optimized functioning
  2. High-security environs
  3. Multiple datacenters
  4. Handle high traffic spikes
  5. Dedicated resources
  6. Multiple applications installation
  7. 24/seven support

There is simply a small list of the advantages of using deject storage. I'one thousand certain you lot don't want to miss out on these options. All you need is peace of mind. You must hire a sysadmin to gear up upwardly a consummate server on whatever of the in a higher place-mentioned hosting service providers.

What if a tell you that you don't need to know Linux or hire a sysadmin? Yeah! Cloudways managed hosting is your new domicile.

What is Cloudways? Haven't heard!

In unproblematic terms, Cloudways is a managed cloud hosting platform through which you can launch PHP / Laravel servers and applications with a 1-click installation characteristic on pop cloud infrastructures service providers like DigitalOcean, Linode, Vultr, AWS, and Google's GCE server. You can handle the server settings, monitoring, security, and performance options on Cloudways managed hosting platform with few clicks. The Cloudways servers come pre-installed with Git, Composer, Supervisord, PHP-FPM, Redis, PHP debugging tools, Memcached, etc. and then you don't demand to pick upwards commands and run in SSH.

Cloudways also provides you lot like shooting fish in a barrel server and application management options similar DNS Management, MySQL migration, SSL certificates, SMTP, Server Cloning and Transfer, Squad Collaborations, Staging Environments for developers, and lots of other features. Sounds practiced?

To get the benefits of a deject hosting service, you must first create an business relationship and launch your PHP server on Cloudways. But commencement, you need to ditch your shared host and backup your complete website files and database to migrate PHP apps on Cloudways.

Experience 10x Faster Load Fourth dimension On Your PHP Web Applications

We empathize the value of faster websites in today's highly competitive business era.

Backup Your Complete Website

Traditional shared hosting like Godaddy, Hostgator, and Bluehost always take Cpanel installed for your convenience. You can backup the complete website by using the compress pick. As well see bluehost alternative.

Get-go, yous must log in to Cpanel and create a aught file of the complete website folder.

php website backup

Once the pinch procedure is consummate, log in to the database manager (PHPMyAdmin in many cases) from where you can drift the MySQL database and export that to the local system.

export mysql database

At present you have the consummate zip file for migrating the MySQL database. We'll come across how to migrate the MySQL database later in this article. Simply now, it's fourth dimension to say goodbye to the old shared hosting service.

PHP Migration on Cloudways

Now you are but nearly to become a new, fast, and highly optimized hosting service. I assume that you lot have already signed upwards to Cloudways, and you are ready with your commencement PHP application server. If not yet, yous tin can follow the gif below:

Now, you have launched the server successfully. You have two options to upload your website file:

  1. Using SSH
  2. Using FTP

If you are familiar with SSH commands, then it's easy for you to upload files via wget control. Do recollect that you have a nada file on Cpanel and it's still in that location. Yous must copy its URL. For instance, I have a website https://shahroznawaz.com and I've created a complete zip file on root the URL will be https://shahroznawaz.com/website.zip . Now log into Cloudways SSH Terminal using your chief credentials. You tin can find them on the Access details page.

launch ssh

Once you have logged in, navigate to the public_html binder and run wget command:

navigate to public_html

Hit the 'Enter' cardinal to copy the zip file to the root directory. Now unzip the file by running the command:

Unzip your-website

Striking the 'Enter' key to extracting all the files to the root directory.

Using FTP in Filezilla

The second option to migrate your website is via FTP using FileZilla client. Y'all tin simply connect FTP with principal credentials (host, username, password). So navigate to your application folder again and drag all the files into the folder. There is no need for a zip file hither.

filezilla ftp

MySQL Migration

You have all the website files. At present, information technology's time for MySQL migration and to import the database. Cloudways provides the custom database panel – for your convenience – just like PHPmyadmin from where you can easily migrate MySQL database. You must navigate to the Application Details Page and click on Launch Database Button.

launch mysql manager

For MySQL migration, you can import SQL file from here:

mysql migration

Upload the SQL file, and click the Execute button. Your database is now populated with your desired files.

Change MySQL Database Configs

At present that your MySQL migration is completed and you have all the files and database uploaded, you must change the database configs in your config settings to completely migrate the MySQL database. It is because you accept an old database username and password in the config file. For Cloudways, you lot tin can get the DB credentials from the same screen where you have launched the database under the MySQL Access section. Copy credentials and replace them in your config file.

Test On Staging URL

Cloudways also provides a staging URL through which you tin can run PHP applications in the browser before pointing out the domain name. These staging URLs assistance developers to quickly test and develop apps in a dev environment. In one case you lot have completely set up and migrated the PHP awarding, yous can point your domain in DNS Direction Tab, replacing the staging URL with your actual domain name. Don't forget to indicate your server IP and staging URL in the domain registrar.

That'southward it! Your website migration process from shared hosting to a cloud server is consummate. Yayy!!

100% Secure PHP Hosting with 24/7/365 Efficient App Monitoring

We offer the all-time in class security of your web applications with proactive app monitoring.

For migrating one PHP version to another, you lot could use some pre-congenital PHP migration tools . For example, migrating PHP five.x to PHP seven.x often looks a tedious task to the developers. Just using the pre-congenital PHP 7 migration tools , y'all could hands lessen your dev piece of work having migration done in minutes.

Now most all the application essentials have set up and you can run information technology in the browser. There are some other important steps that you must consider. I will elaborate on them in subsequent paragraphs.

Essential Settings for PHP App

In that location are more settings that you may need in PHP applications similar retentiveness limit, upload size, display errors, xdebug settings, PHP-FPM rules. Cloudways offers you the flexibility to prepare up these options directly from the platform. Therefore, you don't need to discover the php.ini file and edit it.

cloudways php settings

In Accelerate Tab, you can set up more advanced settings like OPcache.

opcache settings

In the Packages tab, you have 4 versions of PHP available five.half dozen, seven.0, 7.1, and vii.two (7.3 is in the testing stage). Y'all tin upgrade or downgrade the PHP version hands from the drop-down menu. There are also another PHP packages available which yous can install with a single click.

manage cloudways packages

Enable Free SSL certificates (HTTPS Redirect)

Afterwards the successful setup and migration of your PHP app, you must install an SSL certificate in your application. Cloudways provides a free SSL certificate from Let's Encrypt. You lot just have to add together an email and domain name to install the certificate. Once you take installed the SSL certificate, yous can set up the toggle to auto-renewal so that your certificate will motorcar-renew after 90 days.

Enable ssl

Afterward installing the SSL certificate, you lot must redirect Http URLs to https by calculation rules in the .htaccess file. Also, replace all https URLs from your lawmaking.

Testing on Shared and Cloudways Server

As I've mentioned in an before paragraph, shared hosting is non suitable for websites loading rigid content and dynamic templates. To concrete the instance let's test the website on both platforms. I've used the admin dashboard and install on both shared hosting Cpanel and my managed DigitalOcean server with London Data Eye.

Pingdom Test

Shared Hosting:

shared hosting performance

Cloudways Managed Digitalocean Server

Cloudways php speed

Apache Benchmark Test

Shared Hosting:

shared hosting apache benchmarks

Cloudways Managed Digitalocean Server

cloudways php apache benchmarks

Both of the tests are cocky-explanatory. The results show a major departure in data. The Pingdom shows the load time on shared hosting is: 1.41 sec while on the Cloudways server information technology is 309 ms.

For the Apache benchmark test, I've set m requests with 100 concurrent users and the outcome for shared hosting is asking/sec = 560 and for Cloudways it is 735 request/sec. The time to process each asking is too much lesser than a shared hosting server.

This is a simple examination. If I must get ahead with more customizations – with caching, OPcache, PHP-FPM, and Memcached – the results will change drastically and yous will become an optimized picture.

Expect out for PHP versions at Cloudways

While you lot successfully migrate PHP application at Cloudways yous must look out for the relevant version of PHP in which your application is adult. Cloudways provides a variety of four versions of PHP which are 5.6. vii.0, vii.1, and 7.2 (7.3 in testing). By default 7.0 is installed when y'all launch whatsoever new server on Cloudways. You can easily upgrade or downgrade the versions. Think the PHP volition install on the server level so all of your applications existing on 1 server must be uniform otherwise run just 1 application on the server.

For updating the PHP version you can move to Server details → settings & Packages →  Packages Tab. Here you will run across the drop-down of the PHP version select your desired version and update information technology.

Migrate PHP To New Versions

Since the terminal 2 years, PHP has evolved then much that the scripting language got a major update of PHP 7.0 version later that a series of seven.x versions has come up for developers. At present, the most stable version is PHP seven.3. Previously we have written an article on migrating PHP 5.six to seven.0 which you can follow if your application is still using five.6 considering whatsoever kind of update is finished at present for this. The recommended version is now PHP 7.3 so you should also migrate PHP to this version then that the coming can be incorporated.

The first affair you must encounter is the depreciation in the current version so that you can replace the updated code available in a new version like vii.0. But the biggest pain is when you have the large codebase and you need to migrate the code.

At this fourth dimension, there is no automated PHP migration tool to accomplish the version migration simply of form, there are tools available to place the deprecations and compatibility similar these:

  1. PHP vii Mar
  2. PHP 7 Compatibility Checker
  3. Phan
  4. Phinx for MySQL database migration
  5. PHPto7aid
  6. PHP 7 Upgrade Tool

The above tools will help you find out the depreciation, Errors, and warnings. Some tools as well help to drift databases like Phinx.

I've already mentioned the migration guide from PHP 5.6 to 7.0. You can likewise see the official migration guides for vii.1, 7.two, and 7.3 versions.

Q: Tin I use multiple SQL database files?

A: If multiple SQL files are present, the import/migration will neglect. Merely provide one .sql file per site equally Cloudways only allows 1 database per site.

Q: How long does it take to transfer a website from 1 host to another?

A: To transfer a website from ane hosting provider to some other, it shouldn't take more than than 10-12 hours, and virtually of that time is DNS propagation. The speed of the migration depends largely on your hosting providers.

Q: How can I speed upwardly the propagation procedure?

A: The brusque answer is no. Generally, the default TTL is set to 14400 (4 hours); even so, the network that you are using to admission the internet may update at a slower rate.

Final Words

This brings usa to the terminate of this commodity which thoroughly explained how to drift PHP apps to Cloud hosting. Ain't yous happy now? All y'all get is fast servers which give your website maximum uptime and you don't need to crack your caput with support services of that lousy shared hosting providers. Since you are utilizing the defended resource at present, there is no threat of external malware and virus attacking your website, considering Cloudways firewall is there to salve you from these attacks. You tin also set custom notifications and alerts for your server health that means if your server goes downwardly you lot will get a notification instantly.

Share your opinion in the comment section. Annotate At present

Share This Article

Customer Review at

"Cloudways hosting has one of the best customer service and hosting speed"

Sanjit C [Website Developer]

Source: https://www.cloudways.com/blog/migrate-php-and-mysql/

Posted by: dumontaftes1955.blogspot.com

0 Response to "How To Upload Php And Mysql From Localhost To Existing Web Site"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel