Category Archives: PHP

Manage project dependencies with Bower and Composer | Inviqa

As developers, most of us rely on third-party libraries as part of our web applications. PHP developers manage their dependencies with Composer, but how can you manage your client-side dependencies? Most projects start with one core JavaScript library (e.g. jQuery) and one or two plugins, but over time the application grows, and the list of JavaScript libraries grows as well.

Source: Manage project dependencies with Bower and Composer | Inviqa

PHP connection to Microsoft SQL server from LAMP server

We have recently been working on a project for a client that involves dynamically creating web pages from data stored in a Microsoft SQL database. The solution is based on a LAMP (Linux, Apache, MySQL and PHP) server running Ubuntu.

Why not use IIS I hear you ask? Mainly because of costs and licensing and the Ubuntu server will be running several Web sites.

Here is a very basic example of the PHP code using PDO and DBLIB:

$user="username";
$password="password";
$dbh= new PDO('dblib:host=SERVERNAME\SQLSERVERINSTANCE;dbname=DBNAME',$user,$password);

$query = “SELECT * FROM SOME_TABLE”;
$statement = $dbh->prepare($query);
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);

var_dump($result);

You need to install the DBLIB PDO driver:

sudo apt-get install php7.0-sybase