I have all the PHP files and mysql database created on localhost through XAMPP. I have an account on Bluehost. Now I want to launch my website. So where to transfer the PHP files and where to transfer the mysql files on Bluehost? I know I can do it through FTP but I don't know where to upload these files to get the website running?
Apart from that I have one more doubt. Suppose I create a database directly on web server using phpmyadmin facility provided by Bluehost and try to link my php file kept on local host to that database what's the procedure?
You upload your files to the folder your domain is setup for, if you are using your main domain setup on bluehost (you can have multiple domains on same account, but they use different subdirectories of public_html) just put the files in public_html
As for the database you export your database on localhost (mysqldump or export feature of phpmysqladmin or whatever you use) and import it using the phpmysqlamdin import feature
and if by "link my php file kept on local host " you mean how do you change the php files to connect to the bluehost database you just change the mysql connections to use localhost, and the username and password of the database you setup on bluehost.
You can setup databases using bluehosts database wizard, it will walk you through making a database and setting up a user, those will be the database name, username and password you will need for the mysql connections.
Related
As WordPress uses a wp-config file for connecting with the main database, and usually the database server is hosted on the same platform. But I want to use a third-party service or database provided by another hosting platform.
For example,
The website is hosted on Siteground and it will use database services from Bluehost.
I have tried this by setting all the details in wp-config file,
dbname
username
Password etc.
but I'm facing Error Connecting With Database. Could you please suggest to me, Is it possible with WordPress or what are the other ways?
I have got a cPanel hosting and I can create and log in to the phpmyadmin and change databases after I log in to the cPanel. What I need to do is log in to the same database even if my files are not on the same server, so I need to specify the exact database URL instead of "localhost". How do I get that URL?
The most secure way to access a remote database server is to setup SSH access on your database server and a SSH Tunnel on the web server that is hosting your files.
See: Connect to a MySQL server over SSH in PHP
This way you don't need to expose your database server to the internet, and instead can access it from the localhost of your web server.
If the database is exposed to the internet, you can assign a domain name to your database server and use that domain name, or subdomain, as the host and create a wildcard user like root#'%' but that is far less secure.
I have built a website, to check its working functionalities, I used WampSever to create a local server and used phpMyAdmin for the database. But now I need to host the website on a given domain. So, how could I do that and also, how do we need to transfer the database or is there any need that a database should be present in the location or it can keep using phpMyAdmin? Kindly help me with this.
Your website that you've built is composed of a few pieces:
The web server: You are running Apache with PHP.
The files: You have written .php, .html, and most likely .css and .js files
The database: You are using MySQL (phpMyAdmin is not the database, it's merely a client).
All three of these pieces need to be present on the server behind your "domain". You need to insure that your web host is running apache and php. You need to insure that your web host is running a mysql server. You will need to upload your files to your web host/server. And you will need to figure out how to get your MySQL database, tables, and possibly data migrated to the web host's mysql instance.
The trickiest part here is the MySQL component, but generally with the phpMyAdmin you can create a database dump (.sql) file that can then be used to migrate to your web host's mysql instance.
It's impossible to give particulars about how this will look for your web host as each web host is different.
I have a local working Wordpress site and now I'm trying to import the db on a site hosted in Godaddy but it's telling me it can't connect to the database.
Basically I need db name, user and pass in the wp-config and I created manually the db in Godaddy to make sure the table prefixes are the same. Also, Godaddy won't take localhost in the wp-config, you have to use their ip address with a port, something like: 127.0.0.1:1234. The only thing I haven't checked yet are my privileges. Not sure what the defaults are in Godaddy.
For those Godaddy users, Am I missing something? Thanks.
don't upload your local wordpress database like that!
When you create articles, post, pages, etc locally with wordpress it fills your database with your local links. Even if you push it to your new godady database, all the links won't work.
Here is what you have to do:
Create a new database in godady (done)
Create a new user and password for the db with all the priviledge (you have to this, very important)
Upload and install wordpress to your new domain (follow the install tutorial)
Register your dbname, user and password (localhost will work as the db is one godady, but you can put the IP)
Upload your local theme to the new domain (update only the theme, uploads and plugins).
If needed, set up the htacess and permissions to be able to upload files
Download WP Migrate DB on your local project and export the db with your production website info. If you are unsure, install the plugin on the production site too, simulate an export and copy the info to your local project
Upload the migrate database to gadady and then rock'n roll =)
I have a Hotel monitoring web application developed in CodeIgniter.
It monitors each room of a hotel for activities and Sends live data about rooms occupancy, status of electrical switches etc.
It hosted in cpanel web server. I have the same copy of it in my local computer.
I want to synchronize the 2 databases (ie. in localhost and in remote server).
Every change in any database should be automaticaly updated to other database.
First I tried to access my remote database from localhost by putting host name as my cpanel Shared IP Address as follos
$db['default']['hostname'] = 'xx.xx.xx.xx';
where xx.xx.xx.xx is the shared IP of cpanel. but no use.
how should I proceed?
Thanks in advance
Option 1: The Codeigniter Way
You can set up a remote access MySQL server:
Tutorial for cpanel here: https://www.liquidweb.com/kb/enable-remote-mysql-
connections-in-cpanel/
Then just set up a new connection in your database.php changing the to $db['remote']['hostname'] = 'xxx.xxx.xxx.xxx';
Do note that you'll have to make a method to pull in this new data and replace it in your local database, so a script that can be run via cronjob.
Option 2: The Master/Slave Way
You can set up a Master database, being the hotel, and a slave being your local database. I don't know of a method to do this straight cpanel, but you can do it in phpmyadmin, there's a video on how to do it here: https://www.youtube.com/watch?v=nfsmnx24gxU
This method would be the most comprehensive/automatic way to do it. It will overwrite any changes in your database though.
Note that any outside access to a database is potentially insecure. Be aware of this when choosing.