CentOS7, ISPConfig3, and multiple PHP versions

in centos 7, PHP, PHP7, PHP56, ISPConfig, Apache, mariadb

Currently PHP developers face a great problem with PHP version - most OS repos already have outdated versions (CentOS has 5.4 which has passed its end of life!), but just swapping out versions is just not an option - especially with the version requirements of different frameworks / libraries. Furthermore, usually to have more than one version meant recompiling, and keeping up with updates - and no one wants that. Here's how to setup a server (virtual of physical), with ISPConfig3 hosting panel, multiple PHP versions, latest Apache and Mariadb in less than a half hour, with zero compiling. You can then manage your virtual hosts and their PHP version from a nice UI.

Read more »

XDebug your IDE

in xdebug, PHP, Linux, centos, Apache, phpstorm

With most languages, when you develop you get the (wonderfully helpful) option of setting breakpoints, stepping through your code, adding watches and inspecting the overall state at any specific point in time. PHP differs in that, being a scripted language hosted in another process (eg Apache) it normally doesn't offer that. Here's how to enable your IDE to do get all the nifty features.

Read more »

Managing Windows server DNS records from Linux commandline

in dns, Linux, centos, windows, active directory, PHP

I've been in the process of automating the creation of Apache VirtualHosts from the command line for some time now. What always annoyed me, was that after the vHost was generated, I had to manually add the DNS entry on our Windows server. Well…. No more!

Read more »

Why is my system CPU so high?

Had some performance issues with a client, recently. The server is an absolute beast, and should be able to easily handle the single website hosted on it. Alas, pages took forever to load (D7). A simple top showed that load was at about 60, and CPU utilization was at 10% for user and ... 95% for system. Wait what?

Read more »

Protecting your cache folders

I spent the past few days in the VERY unpleasant situation where I had to remove tons of spam-sending scripts from a couple of websites I host. These were in relation to unsecured, unmaintained Joomla! installations, and exploited the cache folder. I won't bother you with the why or how, just know that the vulnerability existed, and has been fixed for versions 2.x and up -- NOT 1.x. Here's the simple way to secure yourself without changing the Joomla site code.

Read more »

Saving Excel files with HTML tables - quirks

in html, tables, PHP, excel, style, formatting

Sometimes you need to save data from your webpage to an excel file. Though there are many libraries that can accomplish that the "proper" way, it is much faster (and easier!) to just output an HTML table to a file with the "xls" extension. However, there are a couple of things to note to make theming look as it should!

Read more »

Solving Sudoku, the Geek way

in PHP, css, ajax, sudoku, github

You probably know Sudoku - the nifty little number puzzle that has taken over most of the world. What I don't like, is having paper versions without knowing if I'm right or wrong. Hence, I made a bot to solve Sudoku grids.

Read more »

Making PHP play nice with Oracle, part 1

in PHP, oracle, oci8, ORA-24408

Today I came to work. It being Monday and all, seeing that PHP stopped talking to Oracle (which it was doing wonderfully until Friday), and that all reports are hence broken (which were not until Friday) is not a good start of the week. Add the cryptic Oracle errors, and you're set for nerve wrecking debugging.

Read more »

Making a connection from PHP to Oracle in CentOS 6.4

in PHP, oracle, oci, centos, 6.4

There are times, when you need to make your app(s) work in a corporate environment. And when you combine corporate with databases, you usually end up with Oracle. In my case, I need to make a connection from PHP 5.3 ( CentOS default ) to Oracle 11g (on a different host). With some luck, this will help others trying the same.

Read more »

Getting the value of a CCK field without node_load

in PHP, drupal, d6, cck, filefield, imagefield

More often than not, you'll come to a point where you need a field value of a node. Not the whole node, just a field. The most common case would appear to be when you need an image (say a promotional image). Some ways are easier than others for it, however you need to think of what you are doing under the hood.

Read more »

Diablo 3 profile parser

in PHP, diablo, library

Diablo 3 is a very popular massively multiplayer online role playing game (MMORPG), by Activision Blizzard Entertainment. With the latest patch, the option to browser through profiles and characters has been given, but the option to get the page as XML (which was available in the respective functionality of World of Warcraft, another product of the same company) was not given.

This project is a PHP class that parses the profile page, and returns all the data in an object. It is still in active development.

Read more »

Nodequeue tricks - Per section block

in PHP, drupal, taxonomy, views, nodequeue

I assume that if you've build a relatively large site, you've stumbled on Nodequeue by now ( summary: it allows you to create lists of arbitrarily ordered nodes ). But clients always had a thing for imagining things that are normally tricky to do, and one of them is to create a block that has arbitrarily ordered content per section of the site, usually by taxonomy term.

Read more »

Block Visibility using PHP

in PHP, drupal, blocks

It has become quite the norm for clients to ask things that are not ready "out of the box". One of the most common is asking if a banner (usually an OpenX zone) can be displayed only in a site area, plus all nodes of a specific term / content type. To accomodate this, you need to delve into PHP visibility rules.

Read more »

Skroutz Drupal module

in PHP, drupal, Skroutz, Module

This is the second part of the pricing integration. It provides integration between the Skroutz API class and Drupal, so that it now becomes a simple matter of installing & configuring the module in order to use Skroutz.

Read more »

Skroutz API Class

in PHP, Skroutz, Class

I've recently been tasked with integrating price information with existing Drupal sites. Since I'm going through the trouble, I like to make things modular -- hence the first step was to create a PHP5 class to handle the "low level" communication.

Read more »

Setting up a LAMP stack on Debian

in Linux, PHP, Debian, MySQL, Apache

I just setup a development enviroment using Debian as my distro. I noted however that when using tasksel (the wizard during installation) to install an SQL server, I got PostgreSQL. Nothing personal with it, I just haven't used it much, and thus hate all the non-MySQL behaviour quirks it has. It just had to go.

Read more »

Galleria per content type

in PHP, drupal, Module, Galleria

Galleria is a popular image gallery module for Drupal 6, which leverages the jQuery Galleria module. It also integrates nicely with Lightbox, Imagecache, and jCarousel. Unfortunately, the publicly available version allows for only global settings, not allowing you to have, for example, a vertical jCarousel for one content type and an horizontal one for another. Hence, this hacked version.

Read more »

Twitter module while stuck with PHP 5.1.6

in Linux, PHP, twitter, drupal

Building a new site today assumes that everything social should come with the box -- not even in it. Within the first question a client asks is how this whole twitter-thing works, and how he can use it. Of course Drupal provides modules to integrate with these, but what if you're stuck on a host  "playing it safe" and sticking with PHP 5.1.6 ( that is, all RedHat, CentOS providers that won't use custom compiled packages )?

Read more »

Creating your first Facebook app

in PHP, facebook

Facebook has changed their API on the 11th of March, 2011. The main feature is allowing you to create application using iFrames instead of FBML -- which is great! The problem is that I spent half a day for something that should only take 10mins; that is, figuring out what you need to do in order to integrate your custom PHP code with Facebook.

Read more »

Find where php.ini is located

in Linux, PHP, Console

So you're enjoying your Webserver features, when you realize you need to change something pretty basic, such as the memory limit of PHP. That of course, is set through php.ini ... but where is that file located?

Read more »