2015-01-03

Setup a PHP development environment on Fedora 21

So you've installed Fedora 21 and are struggling on getting PHP to work? Done that been there...

These step-by-step instructions will help you setup the environment in a way you can easily develop and test an application with PHP and MariaDB on your workstation.

Let's assume we want to use the following directory as the root directory for our project:
 /home/twillber/www/project1

Directory permissions

Ensure that everyone - or at least Apache -has permissions to access that directory. Do the same for all directories in it's path.
 chmod a+rx /home/twillber/www/project1

Since we are operating in your home directory SELinux should have no issues with this. If you decide to go outside of your own home directory you'll probably need to set the correct context to the www directory.

Install packages

First we'll install the required packages for PHP and MariaDB (replacement of MySQL).

 yum install httpd php mariadb-server php-pear-MDB2-Driver-mysqli
 systemctl enable httpd

 systemctl enable mariadb
 systemctl start mariadb

Apache configuration

 Create file /etc/httpd/conf.d/mylocal.conf with the following content:

 < Directory "/securehome/twillber/www">
  DirectoryIndex index.php index.html
  Options +Indexes +FollowSymLinks +MultiViews
  Require all granted
 < /Directory>
 Alias /project1 /home/twillber/www/project1/
 Alias /project2 /home/twillber/www/project2/


Ready to go

At this point you probably want to create some kind of index.php into your working directory. Maybe even use mysqli API to connect to MariaDB, write some HTML and CSS and make the next killer app!

But first, restart Apache:
 systemctl restart httpd

Then use your favorite browser and see the magic:

 http://localhost/project1

2015-01-01

Threw away my Mac Mini

Some time around 5 years ago I replaced my last Windows desktop computer with Apple's Mac Mini and XBox 360 since I had used the Windows only to play games.

I've been using Linux at work since 1997 and as a second computer at home as well, but the Mac was my primary workstation at home for past five years.

Mac Mini is a great computer and OS X provides exceptionally good user experience. Towards end of the year 2014 I decided to find an alternative and more open solution. The problem was to find suitable hardware.

Intel to the rescue  

After somewhat random online investigation I decided to try my luck with Intel NUC, Next Unit of Computing. Now I've got this beautiful small box full of state-of-the-art hardware, model D34010WYKH.

My NUC came with Intel i3 4010U CPU running at 1.7GHz and I installed 8GB of RAM and a 512GB SSD disk, which were not included in the package.

This model of NUC comes with one Mini Display Port and one Mini HDMI connector, works well for me since I use a 50" TV as second screen to watch movies.


Mac Mini was small and very quiet, but with SSD disk the NUC is completely silent and even smaller than the Apple box. Stacked NUC with Raspberry Pi to give you an idea of the size.

The total cost of the hardware was approximately 500 EUR here in Finland. Cheapest NUCs start from 113 USD on Amazon with entry level CPU and without RAM nor disks.

So hardware was found, what should I run on it?

Linux to the rescue

Since I work for Red Hat it shouldn't be too hard to guess I favor running Fedora at home.

Everything I need from my home workstation works today on Linux; web browsing, video streaming services, photo editing, office suite and games.

I'll write more about the applications I use on the next blog post.

Stay tuned!