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 »

CentOS 7, Active Directory and Samba

After playing around with CentOS 7, I was amazed at how simple things that are traditionally annoying as heck are - if you get the config right, of course. One of these is getting a Linux share viewable on Windows clients, with Active Directory authentication and authorization, which I'm going to describe in this post.

Read more »

CentOS 7 server installation

in centos, centos 7, Linux, installation, guide

CentOS 7 is out, and it brings some much needed features for web developers! For starters, MySQL is replaced by MariaDB (much better performance for InnoDB, and a better client), and PHP is 5.4 out of the box. In addition, multitudes of tweaks have been made to the system, making it more responsive.

The following is a guide (with screenshots) for installing a basic LAMP stack with the new OS, on an empty machine (in this case, a virtual machine), using the NetInstall image (Minimal is not yet available, but being worked on).

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 »

Recovering InnoDB tables from ibd and frm files

in MySQL, innodb, recovery, Linux, centos, ibd, frm, shell

First day of the year in the office, and a call came up "site isn't working". Browsing to the site, I noticed it couln't connect to the database. Thinking it was probably some glitch, I logged in remotely to the server, to find that the filesystem was readonly. After trying to figure out why me, being root, could not do anything to the filesystem... it rebooted. My first filesystem crash.

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 »

Setting up passwordless SSH in 2 easy steps

in Linux, SSH, key, password, command line

There are times when you really want to get rid of SSH password authentication, however SSH is VERY picky about permissions etc. I just found out that there's a tool for that in all Linux boxes!

Read more »

Resolving .local domains on Linux

in Linux, dns, active directory, local

I recently started working for a big firm, which (naturally) uses Active Directory. The domain is company.local , with useful servers all having the addresses server.local etc. To my surprise, Linux didn't ask for DNS resolution on these names, making it very hard to work. Thankfully, that's simple to resolve.

Read more »

Recursively changing permissions

There are times when your website's filesystem permissions get screwed. There's no other way to put it -- some directories are not writeable, some are not ... ARGH! The worst part is that you need to apply different permissions on files and directories, to prevent security issues.

Read more »

Automate MySQL database & user creation

in Linux, MySQL, bash

Continuing from the Apache virtualhost article, this is another script that automates the creation of a MySQL database and a user with all permissions to it.

Read more »

Scripting Apache virtual host creation

in Linux, Apache, bash, vhost

Virtual hosting is one of the most important things to happen in web hosting over the recent years. It allows a single IP to be associated with multiple websites. Though there are many panel solutions that offer virtual host management, it's nice to know what's going on and even better to actually be in control. The tradeoff is that small mistakes can cause all of your sites to go down until you fix them -- unless you automate.

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 »

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 »

(Un)compressing directories

in Linux, filesystem, tar

For all (well most) of your console compressing / uncompressing needs, tar is there. All you need to do is set it to work.

Read more »

Anatomy of a simple file listing (ls)

in Linux, filesystem

Assuming you've spend anything more than an hour with a Linux server on the developer/admin side of things, you've most likely bumped into the filesystem permission scheme.

Read more »

Schedule commands for later using 'at'

in Linux, Console, scheduling

There have been a number of times when I've realized that I must restart some service at a production server. In such enviroments, restarting a critical service ( e.g. MySQL on a webserver ) in a production enviroment is simply a no-go during hours with traffic. And since the lowest possible traffic is during morning's early hours, you can either "schedule" your service restart to occur after going out with friends for a couple of beers, be awake {until|at} that time.... or simply let your server know that something needs to be done at that time.

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 »

Make SSH faster

in Ubuntu, Linux

Well, at least the login part. For some (very) weird reason, some distros think that everyone is part of some huge, corporate environment -- thus making Kerberos and GSSAPI logins the default methods.
Is there a problem with that ? Well, not directly - you only need to wait until SSH can understand that login just ain't gonna happen that way, and fallback to the good' old username/password asking. The real problem is that it can...take...AGES!

Read more »