Transcript

Hosting Packages, FTP, and other Hacks

14 February 2012

Connection Strings

• Be wary of differences between dev and live environment– Code syntax may vary.– Look at the version of code you are running in

development! Is it the same as the hosting plan or server you plan to use.

$mysqli = new mysqli("sql6.hosting365.ie ", " Ballins_aonghus ", “password", “Ballins_gps ");

if (mysqli_connect_errno()) {printf("Connect failed");exit();}else {$sql = “Select * From Users";}

Did not work in Register365

$mysql = mysql_connect("sql6.hosting365.ie", "Ballins_aonghus", “password", "Ballins_gps") or die("Could not connect: " .mysql_error());

This did work in Register365

Hostname - localhost

• Development environments set up on your local machine can often use localhost

• A hosting package will commonly provide you with a hostname.– E.g. sql6.hosting365.ie

Client Requirements• If client has its own server or has an existing

hosting plan with a provider, they may require your system to be built in compatible versions of code.

• E.g. UCC does not support php > version 4– New functionality included in php 5 will not run on

their server and will break your site!– Be careful to plan for this

Hosting and Domains

• You will need a hosting package or server space on existing web server (e.g. ucc.ie)

• You will need to register a domain name separately (e.g. .com; .ie; .eu; etc)

• Typical vendors will provide both services

Hosting and Domains

• Local business providing hosting and domain registration: CCS Host in Carrigaline– http://www.ccshost.ie/dedicated-hosting.php

• Others include register365.ie; blacknight.ie; lethost.com

Hosting Package

• Gives you server space– Essentially you will be provided with a “file-

manager” type of set up– Here you will be able to store your website files

for each domain sitting on your hosting package

• Typical admin section allowing you to manage databases (if included in your hosting package)

Domains

• You can register domain name without having a hosting package

• .com is cheaper and involves less admin to obtain than .ie domains– With .com you choose an available domain name,

pay the fee and its registered a couple days later– With .ie you choose domain name, pay about 2/3

more, and you must provide license, id, and business number etc

Hosting and Domains

• Once you have obtained a hosting package and a domain name(s)– Add the domain to your hosting package. This will

create a subfolder on your hosting package server space

– wwwroot is typically what you will see in your server folder for each added domain. Within this is where you place your web files

Hosting and Domains

• Having added your domain(s) to the hosting package you will be able to access a range of admin settings:– Creating FTP accounts– Creating email accounts– Managing dBs– Etc etc

File Transfer Protocol (FTP)

• Allows you to transfer files to and from an external server

• Very useful if you need to upload many files (e.g. Wordpress, Joomla, Drupal)

• FileZilla is a freely downloadable FTP client

FTP

• Can set up FTP user account access from your hosting admin section.– Username– Password– Hostname (not localhost)– Port (sometimes specify – leave blank otherwise)

Secure Shell SSH• Depending on your client you may not have

access to a nice GUI interface to work with databases.– Sometimes you may have to access database

directly.

• SSH is a way of doing this. Freely downloadable SSH client is Putty. – Contact me if you need more info/help on this!

SSH via Putty

Any other Issues

• SMS – Clickatell ??• PayPal integration• OpenCart• Wordpress, Joomla, Drupal

RESTful Web Services

• Anyone developing using web services??– Really hot area – Simon Woodworth is the

authority you’ll want to talk to

– Doodle API – Can access this using a range of different languages

Clickatell – SMS Sample Code

• Clickatell will provide you with a file which will contain class and methods allowing you to access their SMS Api

• Create an account with clickatell online and purchase credits. You may be able to get sample credits for testing environment before you go and buy real credits

Clickatell – SMS Sample Code

• Within the class provided by Clickatell, change lines of code to reflect your clickatell id, username, and password. Example below in php (generally the same process in other languages)

• Within the class sms change the following variablesvar $api_id = "33453476"; [Whatever api_id you are given when creating clickatell

account online]var $user = "aonghus";var $password = “kerryforsam2012";

Clickatell - SMS Sample Code

• In whatever code file you wish to access the sms functionality you will need to create a new instance of the sms_api object.

• The following php code references the sms_api.php file (if using java you may use something like import … and so on). Then create new instance of sms object require_once ("sms_api.php"); // Load sms-api class

$mysms = new sms(); // Initialize object. Take note of the name you choose here ($mysms) for later

Clickatell - SMS Sample Code• In order to send a SMS, you can call the send method which

resides in the sms_api.php. Note this requires 3 values to be passed to it.

$fornum = “353860000001”; // variable holding phone number$mname = “RandomCo”; // variable to hold name of sender that you want to present on the receivers screen$body = “Hi, special offer all this week at RandomCo”; // variable to hold message

$results = $mysms->send($fornum,$mname,$body);//$mysms is name of instance of api object chosen in the last slide. ->send($fornum,$mname,$body) calls the send method within that api and given that you provide it appropriate values and you have enough SMS credit, it will send message.

Any Questions

• You’ll find online contact form and details at http://aonghussugrue.wordpress.com/about/

top related