Normally, a real-life PHP application is run on a remote server and is accessed through a File Transfer Protocol (FTP). To deploy your CRUD application on a remote server, you will need to register an account on a hosting provider, register an FTP account, and create a remote database.
You can use any hosting you like. The current document describes the deployment procedure on the X10HOSTING free hosting. This hosting includes a MySQL but not an Oracle database server.
All the user names, passwords, and email addresses are fake and used as examples only. The administration of the hosting blocks an account if the user does not show up on the forum fore more than a week. So you may fail to apply exactly the same user names, passwords, email addresses, and other credentials from the tutorial.
Change your database connection settings to use the remote database
The current document is a part of the Creating a CRUD Application in the NetBeans IDE for PHP tutorial.
Application Source Code from the Previous Lesson
MySQL users: Click here to download the source code that reflects the project state after the previous lesson is completed.
Registering an Email Account
Create an email account, if you have not created it before. In this example the email address is
Registering a Hosting Account
To create a hosting account on the X10HOSTING free hosting, follow the steps in their wizard, entering the following settings. You will enter similar information on any other hosting site.
Hosting Account Username (also for login to cPanel)
phpuser
Hosting Account Password (also for login to cPanel)
qwerty1234
Forum Username
phpuser
Forum Password
qwerty
FTP Account name
uploader
FTP User Name
FTP Server
ftp.phpuser.x10hosting.com
Remote Database Host Name
phpuser
Remote Database
wishlist
Remote Database Username
phpuser
Remote Database User Password
phpuserpw
Registering an FTP Account
Now that you have a hosting account, you need an FTP account where you will transfer your PHP source and other related files for executing them on the server. For x10Hosting, you opent the cPanel and select New FTP Account, then follow their wizard.
Creating a Remote Database
Because the CRUD application uses a database you will also need to deploy the wishlist MySQL database on the remote server where you have a hosting account.
Setting Up a PHP Project with Existing Sources and Remote Web Site Run Configuration
Download the source files that correspond to the state of the application after the previous lesson is completed. Extract the files.
Specify the location of the downloaded sources in the Source folder
Choose the Remote Web Site run configuration and configure the FTP connection
Complete the project creation.
Updating the Class WishDB
So far you have developed and run the Wish List application on the local web server and used a local MySQL or Oracle database server. To make your application work with the remote MySQL database, you need to update the connection settings specified through the variables of the class WishDB.
Open the file db.php.
Change the variables of the class WishDB:
var $user = "<the name of the remote database user>";
var $pass = "<the password of the remote database user>";
var $dbName = "<the name of the remote database>";
var $dbHost = "<the account username specified during the hosting account creation>";
In this example the variables will be updated as follows:
var $user = "phpuser";
var $pass = "phpuserpw";
var $dbName = "wishlist";
var $dbHost = "phpuser";
To send comments and suggestions, get support, and keep informed on the latest
developments on the NetBeans IDE PHP development features, join
the mailing list.