Archive for category General

I started to write a new app I grabbed the latest Symfony code, which happened to be the newly released Symfony 2.5.0. After going through to normal steps to get it setup I tried loading it via my browser and got a blank page.

There was no output in the browser, but the Apache error logs showed this:

PHP Fatal error: Class 'Symfony\\Component\\Debug\\ExceptionHandler' not found in vendor/symfony/symfony/src/Symfony/Component/Debug/Debug.php on line 46
PHP Fatal error: Class 'Debug' not found in web/app_dev.php on line 21
PHP Fatal error: Class 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\ProfilerPass' not found in vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php on line 68
PHP Fatal error: Class 'Symfony\\Bridge\\Doctrine\\DependencyInjection\\AbstractDoctrineExtension' not found in vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php on line 34

At this point I’m getting a bit concerned there is something with my server or something more severe. These errors aren’t consistent and seem to randomly be popping up…

After a bit of frantic checking of my other sites, server logs, apache logs, and others it dawns on me I have APC on…I tried turning it off and viola, it works.

With Symfony 2.5.0 APC seems to be used by default whereas this wasn’t the case before.

I was already running behind on my project so I haven’t looked into disabling APC for dev yet, but that would be a better solution that turning it off.

TLDR: APC is likely the cause of inconsistent errors that don’t make much sense in a fresh Symfony 2.5.0 install.

I hope I am able to save someone the trouble of debugging this like I had to. If you know a better solution to resolving this than turning APC off please mention that in the comments.

I ran into an issue while installing FusionInvoice recently. I Googled the error with no luck. It took me a bit longer than I’d like to admit to fix it so I hope I can make it easy for someone else.

FusionInvoice is a self hosted invoicing/tracking web app. I needed something simple to track the small amount of hosting I do on the side and this fit the bill perfectly.

While installing I kept getting blank options for the language list. I went in a started poking around in the code. I’ve never worked with CodeIgniter before but with it being a MVC framework, it was simple enough to find my way around. I set the languages variable by hand to get past that step, but more issues came up which were a result of the underlying problem.

On my Linux server by default I setup all directories for web apps with the permissions 711. Which means owner: read write execute, group: execute and other: execute. This allows a web app to access files in a directory and sub directories, but does not let them list the contents. A small security feature to make things a little harder if someone were to gain unauthorized access via a web vulnerability.

directory_map lists the directories in languages/, and it was failing because it didn’t have necessary permissions.

I haven’t ran into this before in other webapps, so while it is obvious now it was not at first. To resolve this issue change the permissions to 755. You can do this to all directories in the web app by running this in the document root:

In one of my recent gaming sites, I was trying to find a way to have one game fit in as many different categories. I am still rather new at Symfony, and heck PHP programming in general, so the idea of setting this up myself was a bit overwhelming. At least being able to manage it correctly in the backend. The data structure, thanks to Doctrine, wasn’t that bad to setup.

Anyways, I found an awesome blog post talking about exactly what I wanted to do. I followed this post step by step, doing slight modifications for my setup, and it worked perfectly!

Most of my new sites I run are running on top of the Symfony framework. One small annoyance I run into is when caching pages, it will create a new cached file for a URL which includes a parameter that doesn’t affect which page is returned.

For example, on my flash game sites when I sponsor games I use URL parameters to track where traffic is coming from when people click my in game logos/links. This creates a huge number of cache files that are really useless, as they contain the same info. This slows down my page load as well, as it essentially ignores my cache and creates a new version each time if someone comes to my site from one of those logos.

I found a blog post by someone who has fixed this issue. This is a perfect fix for this issue, and I thought I would share the link.

Wow – that’s all I have to say about this latest discovery. I have built plenty of websites in my days, and it’s always a struggle portraying what you want your layout to look like to a designer. You can give them pages of descriptions, but they will always forget something, or not fully understand something you said.

I have discovered wireframing for websites. I expect most experienced designers would have just laughed, as they have been using these for years. But for someone like me it’s a great way to sit down, spend 20 minutes to hours deciding how you want your website to be laid out.

There are plenty of wireframing tools out there, which I’ve found out searching Google for a bit. I wanted to work with a non web based solution, as I can save the output to a Dropbox share and work on it at work or at home. I have settled on a cool and simple one called Pencil.

If there’s anyone like me who has a good feel for what kind of layout they want, suck with design, and have trouble explaining to designers exactly what you want…this is gift from above.

I hope this little tip for planning the layout of a new website helps you.

In SEO many times quick and easy is a sure way to get a penalty on your site. This isn’t always the case though. There are a few sites out there that provide value while offering a link back to your site.

The site I am talking about right now is AboutUs.org. It’s a directory of websites where you simply talk about your site. You can include things such as contact info and a brief overview.

Initially you will find that your link is NoFollow. Which is the way you tell Google you don’t trust the link. It’s good that they do this, as you don’t want directories linking dofollow to the many spammy sites out there. The link can be changed to dofollow with a little bit of work though.

I have just recently launched my latest and best gaming portal to date. It’s dedicated to parking games. I started with a descriptive domain and added a (IMO) very user friendly website – click here to check it out. Parking games are a niche of car games, where the goal is to park cars, trucks and even boats. It’s a pretty interesting niche. It’s not for everyone, but what niche is? I am very excited to build the go to spot for parking on the internet!

This site is built on top of the Symfony framework again. I started with my platform for gaming sites over a year ago now and am very excited to continue to build and improve on it. It’s fun watching my skills advance, and being able to add any features as I want as I launch more and more sites, and get more experience with the platform. I’m a huge fan of Symfony and would recommend it to anyone who wants to build some PHP web apps.

I’d be happy to hear any feedback on the site. And feel free to tell your friends (or kids who may possibly be more interesting playing these flash games) about ParkingGames.com.

I was recently lucky enough to get two out of two raid1 disk failures on an important server running Debian. These two disks were the only disks in the machine. So I had to replace the two disks in a machine quickly…

I’m not sure if it was firmware or what, but these two SSDs went out at the same time. Which was lovely. One failed a bit harder than the other. I was lucky enough to be able to replace one, sync the raid, and then swap out the other. I had very little downtime and it could have gone a lot worse.

One symptom I found later while updating my system is that update-grub fails with the following error:

Generating grub.cfg ...
/usr/sbin/grub-probe: error: no such disk.

After doing a lot of digging on the net, I found out the solution to this is stupid easy. Simply reconfigure the package!

# dpkg-reconfigure grub-pc

I will admit I didn’t look into this enough to find out exactly what the problem was. I know it had to do with replacing both disks in the machine. I hope this simple solution helps someone else out there, and hopefully they won’t have to dig around for 20 minutes either.

Many times you will purchase a VPS and go with the lowest resources you think you can get away with. As your website grows you may find you need to add more disk space.

This can be very easy to do with some basic tools in Linux. I will show you how to quickly and easily do this in Debian – but you shouldn’t have issue doing this in any other distro that includes fdisk and resize2fs.

First, you will need to have your disk expanded in the backend. This will have to be done by the VPS provider. Once the disk has been expanded you will want to reboot the machine. This will allow fdisk to see the larger disk.

The next step is to delete the current partition, and recreate it with the new larger size. Do not worry, the process of deleting a partition doesn’t actually remove any data, just the reference to the partition.

So run:

fdisk /dev/sda

Where sda is the disk in question.

The first command to run is: p which simply prints the current partition table.

I have recently started exploring the new Google Analytics interface and realized how powerful the AdSense integration into Analytics was. I wanted to integrate AdSense and Analytics on all my properties.

I had no problems setting up the primary domain, but noticed any secondary domain would not report the correct revenue. It seems it a fraction of the total, but per site the actual percentage was pretty much the same. After making a post on the Analytics support form and digging around I finally have found a solution that works. It turns out I was only seeing the earnings for the first ad unit on the page.

This thread here fixed the issue for me. I hesitated to even try this solution, as the post is from 2009. After running out of options I implemented the fix they suggested and it worked great. Let me explain the issue and fix in more detail.

When you setup secondary domains in Analytics you are instructed to add this code to the top of the page:

What this does is tell AdSense what your Analytics profile is in order to properly report the data. It appears that the variable window.google_analytics_uacct is only applied to the first AdSense ad unit on the page, and after that it is reset.

The fix is to modify your every AdSense ad unit code on the page by adding the window.google_analytics_uacct = “UA-XXXXXXX-XX” code at the top. Here is an example of my ad unit: