Codeigniter Controllers Give Server 404

I often take shortcuts when setting up my development servers. I recently installed Linux Mint 12 x64 on my main box and wanted to setup a web developing environment on it. To cut corners during package installation, I’ll typically install phpmyadmin which grabs most of the dependencies I need to have a full LAMP dev stack, such as Apache2 and Mysql-server.

That’s how I initially set up my stack in Linux Mint. I also enabled user directories in Apache so I could develop within the public_html directory inside my home directory. All was working well until I copied a CodeIgniter project over and tried it out. I couldn’t access my controller functions from index.php. It worked well for the default controller because it was accessing it from index.php, but when I changed the URL to point to a controller like index.php/admin, it didn’t know what to do with it and I would receiver a server 404 error.

After digging around for a solution, I realized that when I installed my LAMP stack, apt had installed libapache2-mod-php5filter instead of libapache2-mod-php5. I’m not very familiar with this module or what benefits come from using it, but the quick fix was to:

sudo apt-get install libapache2-mod-php5

This removed the php5filter module and installed the plain php5 module. After that, I no longer have an issue with the controllers giving 404 errors.

GoDaddy Alternatives | Boycott GoDaddy

Due to its support of SOPA, many people are calling for a boycott on GoDaddy. At first GoDaddy was laughing because of the planned boycott. After about 24 hours, their tone changed and they proclaimed that they were no longer supporting the legislation. Many people are looking for alternatives to Godaddy.

I searched for a bit and found that about the best deal in town is namecheap.com. There is a transfer fee for moving domains over to them, but you get a free year of registration with the transfer. So for around $7 bucks you can transfer and renew a .com. If you have a few months left before it’s time to renew your .com, you can still transfer the domain and get a free year along with the remaining time of your current registration.

Check out their deals. Let’s show GoDaddy that we do not like their support of this unconstitutional legislation.

NameCheap.com

PHP Video Tutorials

I just started a new website devoted to teaching people how to develop websites. The site is PHP Video Tutorials. So far I have about 20 videos uploaded. There are nine in the first series which teaches basic HTML and CSS. The second video series goes into PHP and MySQL. I think these videos will be very helpful to anyone who wants to get into web development.

The Best PHP Framework

I searched for the best PHP framework for a while. I tried CakePHP, Zend, Yii, Symfony, and Codeigniter. Some of them frustrated me to the point that I was ready to write my own mini-framework. I think the problem with some of them, at least from my perspective, is that they try to do too much. Some were just poorly documented. Sure, you can find all the information you need to find about all the features, but they don’t make it very easy. For this post, I want to compare two of the most recent frameworks I’ve worked with, Codeigniter and Symfony.

I use Codeigniter for all of my personal projects these days. Recently, I had to use Symfony for some other work I was doing. I can see positive and negative aspects of each system at this point, and this is an overview of their main differences.

First, I’ll talk about Symfony. It includes two ORMs, Doctrine and Propel. I was using Doctrine. It relies heavily on the ORM as it should, but I found utilizing an ORM to be overly complex. This may be due to my own ignorance, but when using an ORM, you have to get into a different mindset. Most people would view the ORM as a feature. For me, it was unwanted. Symfony is a great framework and is used by many people. My distaste for it should not be a deciding factor in choosing your own framework.

However, I would like to point out other things about Symfony that I didn’t like. First of all, the directory structure is overly complex, especially when your job is to maintain code that is already in place. You may find yourself looking at a page and going through 10 different files trying to find where the code is located. Symfony has a ton of plugins, many of which have auto-generated forms and templates. There are times that you won’t find the code that generates the form and from what I saw, your only option is to override the plugin’s actions and templates. If the code you’re maintaining doesn’t override the plugin, you will have to check cache files for the auto-generated PHP and then implement this in the override.

While we are talking about caching, I’ll point out that this is a good feature and it’s implemented by default in Symfony. During the development maintenance of a site, however, it gets on my nerves. So, you’ll spend a lot of time clearing your cache from the command line. Symfony depends on command line usage. While I like using a command line in most cases, I don’t want to be jumping back and forth between my IDE, command line, and web browser so much. Since Symfony auto-generates a ton of code for you through the use of the command line, I can see the advantage, but I prefer the Codeigniter way.

So, let me talk about Codeigniter and why I prefer it to all other frameworks I’ve tried.

First of all, it stays out of your way. It arranges your site into three folders, as I think it should, models, views, and controllers. You can then arrange your files in sub-directories under these main folders as you wish. So if you have a user system on your site, you can put all your views for that section under views/user.

While I’m on the subject of views, let me touch on Symfony’s templates and layouts. It’s actually a good system and cuts back on the amount of code one has to write, but it depends on yaml config files in various locations. I liked the idea, but hated the implementation. I much prefer having the view source where I can easily find it. In Codeigniter, I get all my data ready to send to a view, then load that view. In this view, I can load other views as needed. So if my page has a top navigation menu, I can just load that menu from within my view. This templating system works best for me, and I don’t have to search through config files at various locations to find out where the HTML is located.

Finally, documentation is much better in Codeigniter. If you want to know how a library or helper works, their documentation makes it simple to understand. Symfony’s documentation is terrible in comparison. There’s a reference but it’s just not that good. Plus much of the documentation you’ll need is actually on the Doctrine site.

Symfony has many features that Codeigniter doesn’t. Codeigniter is much easier to use, has the best documentation, and is much easier to maintain. These three things are why I prefer Codeigniter. Maintainability and ease of use are the two main reasons to implement a Framework anyway. Without these two things, one would be much better off using straight OOP PHP.

 

 

The Best PHP Framework?

I’ve been really interested in using a PHP framework. One thing holding me back is deciding which one to work with. It seems that every time I start looking at frameworks, I end up deciding to just code everything manually. The major contenders seem to be Yii, Zend, Symfony, CakePHP, and CodeIgnitor. However, I have no idea which one I’m going to use. It’s hard to decide without learning the ins and outs of each one and making a good decision based on that knowledge.

My latest attempt was with the Zend framework. I was getting into it and realized that most of the documentation for setting it up bases the setup from a virtual host in Apache. This would be fine, but it actually makes development and deployment overly complicated for me. My development environment is a Linux machine that is my main desktop. My production server is my own dedicated server with CPanel. Zend doesn’t work very well with this setup from what I can tell.

I want my site to transfer easily between the two environments. I like them to be self-contained as well. I want to throw the framework into a lib folder or link to it in some way. I don’t like that the forward-facing web site is in the “public” folder. I want the root of the website to be the forward-facing public website.

I would really like to use Zend because it has a lot of good extensions for utilizing various web services.

I’d like to hear from others. Which framework would you recommend and why?

Reddit’s Interview with Richard Stallman

Recently, Reddit users were given the opportunity to ask RMS (Richard M. Stallman) questions. The top 25 were answered by RMS here.

For anyone who doesn’t know who RMS is, he is the founder of the GNU project. He wrote Emacs and the GCC compiler. Much of what makes up a “GNU/Linux” (don’t ever let him hear you call it “Linux”), is the GNU tools. Linux itself is just the operating system kernel. Although the OS kernel is a very important part of the OS, a base GNU/Linux system has a ton of software from the GNU project as well. The OS doesn’t work without the kernel, and it doesn’t do much without the GNU tools.

RMS answered most of the questions as I would expect. The one question that stood out to me, although I haven’t made it through the entire list yet, is number 7. The question relates to how the open source world can’t create tax software and games that can compete with proprietary software. It’s a very good question. RMS mentions that the Free Software Foundation in Latin America does have free tax software. He also says

I don’t know whether our community will make a “high end video game”
which is free software, but I am sure that if you try, you can stretch
your taste for games so that you will enjoy the free games that we
have developed, or you can try Roulette Games.

Now, this is the part that really made me think. I’ve always been an advocate of free software, but do I really want to rely on free software to produce video games that compete with some of the games I play on PS3? I truly wish that they could make them, because I’d love it, but I don’t see it happening. Another major point to that comment is that games have always been the driving force in computer hardware improvements. The computer systems we have right now are only this good because of games.

That may be hard to believe, but for anyone that’s been playing PC games for decades, it’s common sense. Video games are it. That’s what all of this technology was built on. You were either playing games or writing them. Sure, computers have many other useful features, but games are responsible for these beautiful user interfaces and awesome sound.

Games kept getting better. Hardware kept getting better. A huge majority of the research and design came from game sales. All of that wouldn’t have happened without proprietary games.

RMS knows that, but RMS isn’t worried about games at all. RMS is worried about software freedom and he has many good points. Those same points could be applied to many industries. To me is seems like the old communism vs. capitalism debate. Extremes on both sides suck. It’s the happy medium we should strive for.

What’s Killing Linux and Software Freedom?

I know many will say “we knew that already” when they read what I’m about to write, but I just came to this realization today. I was reading a blog title “I miss using Linux“. The author was describing some of the reasons he can’t avoid using Windows. That blog is a continuation and actually comprises of my interpretations and expostulation on the previous blog on data synthesis.

There are many good reasons like the ones he offers. Some people want to game, but game companies just don’t make games for Linux because it isn’t popular enough. Others need certain programs that are only available for Windows. Whatever the reasons, it’s not going to be the “year of the Linux Desktop” any time soon, but those people have another option and are Nevada Online Casinos games .

One part that really stood out to me about the post was the reiteration that Photoshop was a main reason for not using Windows. I would actually go so far as to say that the entire creative suite is a major reason more people don’t switch to Linux completely.

Sure, one could possibly run it in a VM but that’s not a good solution. If you need a VM of Windows, why not just run Windows, right? That’s the correct reasoning if you ask me, and I’m a Linux advocate. The problem could be that more people are procrastinating truthfully. They simply don’t want to switch completely or don’t feel comfortable enough in Linux to use it full time. I don’t think this is the prime reason, but for some it could be a factor.

Adobe is the problem, at least in my mind. Adobe is the last non-open company. Microsoft office uses an open document format finally. There is a lot of compatibility with Open Office. Most other programs have decent open source alternatives. Even Photoshop has a decent open source alternative in the Gimp, but some people don’t think it is enough. Adobe has a lock on a lot of the media on the web right now with Flash, even though there are better alternatives to using Flash, most sites use it.

Adobe is holding back Linux. Rather, our dependency on Adobe products is holding back Linux tremendously. There would be a lot more people to adopt Linux if the Creative Suite was available in it. There would be a lot of people adopt Linux is Flash was no longer the defacto standard for media on the web.

Apple has the right idea by not including Flash support on the iPhone. This will help push us away from the closed-standard. I’m for this change.

Browser Extensions For Developers and Internet Marketers

I’m on the fence when it comes to my favorite browser. I’ve recently started using chrome much more, due to some bad performance issues in Firefox. Firefox on my 64-bit Windows 7 installed sits and eats memory. I’ve seen it use nearly 2gb of RAM. This was after it had been open on the computer for a few days, and a restart of the browser fixed the issue. However, I’m not sure why this leak is there. The last time I can remember truly liking Firefox completely was back in the version 1.5 days, and even then there was supposedly a huge memory leak. Back then I didn’t notice a memory leak, but these days I do.

It could be that Firefox utilize memory different, and it may be the new way Windows 7 display memory usage. I still see sluggishness. Thus, my move to Chrome. There area a few different things that could have caused the slowness, such as the added extensions in Firefox. After installing about seven extensions in Chrome, however, I see no performance hit. So, I still suspect that there is an issue with the browser itself. Even with all of these woes, it is still better than using IE. I hate that browser. I don’t necessarily hate using it, but it is difficult to write web sites that work well in it along with all other browser. It’s the odd ball which never works the way I want.

For web development, Javascript is necessary for client-side scripting. However, Javascript is difficult to debug. Luckily, we have the Firebug extension for Firefox. This is the uber-extension for web developers. I’ve used it quite a lot, so much so that it has become a necessity. I probably couldn’t write Javascript without it. There are also other features to this extension, like being able to examine the DOM and such. Internet Explorer has a similar tool set but it’s slow and hard to utilize. I would dare say that there are some IE users who installed Firefox just so they can use Firebug. One setback here is that IE’s Javascript engine has certain nuances that do not readily show up in Firebug. So, while you can debug a majority of javascript errors with Firebug, it will miss certain IE javascript issues.

The next must-have extension for web development is the Firefox Web Developer extension. It gives you a host of options to example page elements and CSS rules within the page itself. This plugin along with Firebug have saved me TONS of time, while working on websites.

SEO is important to not only marketers but web site developers as well. Getting a site online is one thing. Getting it to show up in search results is another. A couple of excellent extensions for examining the search engine optimization of a site are the Firefox SearchStatus extension and the Chrome SEO extension for Chrome. The Chrome SEO extension is great for getting a brief synapsis of your site’s backlinks, pagerank, and indexed pages at various search engines. Neither of these offer a lot of advice for SEO, you’ll need a company that offers Drupal SEO services for that, but they do show some stats to get your started.

These are only a few of the extensions available for Firefox and Chrome. There are many others. They are a good reason to switch from IE. PLEASE DO!

Eclipse issues in Linux Mint

I’ve been wrestling with IDEs and OSs for the past few days, trying to decide which would be best for Javascript and PHP development. I had been using Netbeans. I absolutely love Netbeans, but I found that editing Javascript in it was somewhat lacking. I was having trouble keeping up with my nested anonymous functions and thought it’d be a good time to try out other alternatives.

I bounced around between Linux Mint, Mac OS X, and Windows 7. I find that I would really like to program on my Macbook Pro, but it just doesn’t feel comfortable. There’s something about the keyboard setup or something that just annoys me. It’s more of a problem with my familiarity with the keyboard, I think. At any rate, after messing with Eclipse, Netbeans, and Textmate on my Mac, I decided it was going to be a no-go.

Windows 7 presented a problem in the fact that XAMPP seems to have issues with sessions. They work but almost at random, creating a new session will lock up the entire web server. When you are developing a website which uses Sessions for user logins, that creates a problem. So, I decided it would be in my best interest to use Linux, which seems to be made for programmers, because most programming related things work great in it and the fact that you almost have to be a programmer to get some things to work correctly in it. Though, that is an outdated misconception, but everyone still seems to believe it.

I had been using Linux for most of the development of my new project anyway. So, there was no transition there. I’m using SVN on a server machine so it really didn’t matter which OS or IDE I decided upon for that. They are all pretty universal in their ability to handle SVN. The major exception was Mac OS X which didn’t include the ssh-askpass command needed to tunnel SVN through ssh correctly. I was able to find a shell script that handled the ssh-askpass function, however. Textmate didn’t really work well, either, because it didn’t really have robust SVN integration. It was pretty much just like manual SVN. I also needed separate programs for Diff and Merge. That was lacking and clunky. I was spoiled by Netbeans’ built-in Merge, Diff, SVN, and so forth.

I thought I’d give Aptana a try. It is a PHP developer plugin for Eclipse. It is also available in a standalone package. I had various problems with the standalone version of Aptana so I decided to install Eclipse from the LinuxMint/Ubuntu repositories. Eclipse worked great, and Aptana installed perfectly. However, I needed the SVN tools that are Aptana add-ons. They wouldn’t install. There was a version conflict with the version of Eclipse in the LinuxMint/Ubuntu repositories.

So I decided to install the latest version of Eclipse. I downloaded and ran the latest version and found that there were UI issues. This brings me to the subject of this post. The UI issues were a major roadblock, so I searched for a solution. The problem, I believe, stems from compositing inside Gnome. Unlike Ubuntu, I couldn’t find an easy way to turn off compositing inside LinuxMint. OH, I’m sure I could disable the compositing extension inside the xorg.conf file, but I really wanted a light switch option. The normal way I would handle this is the Fusion Icon. It didn’t seem to work. I also tried disabling effects from the Gnome Appearances menu option. Compositing just wouldn’t turn off that easily.

So here is the solution for Eclipse and Aptana inside Linux Mint.

GDK_NATIVE_WINDOWS=true /opt/eclipse/eclipse

That will work if eclipse is installed in /opt/eclipse, but I just had mine downloaded to my home folder. It doesn’t really matter. You would just change the /opt/eclipse/eclipse to your actual executable path. The key here is to add the GDK_NATIVE_WINDOWS=true before the eclipse command.

I’m about to create a shortcut to do this for me. Now all my buttons will work when I click on them. That’s convenient huh.

Resetting WordPress Passwords Manually

I’ve had to do this for my wife and her mom both, so I thought I would share this with anyone who needs to reset a WordPress password. I personally love WordPress. You can build any type of site with it, not just a blog. If you have created a WordPress site but haven’t visited the admin dashboard in a while, you may have forgotten your password. I thought that WordPress would email you a lost password, but maybe they didn’t put in their correct email address. It could have also been the installation script they used through cPanel. Whichever the case, they couldn’t get into their dashboard and they needed their passwords sent to them.

There’s a very easy way to reset that password through SQL. Whether you are using phpmyadmin or some other SQL client to access your databases, you’ll want to use the following SQL statement to reset your password:

1
UPDATE `wp_users` SET `user_pass`=md5('password1') WHERE `ID`=1;

You can change password1 to whatever you want. I’m amazed that WordPress passwords aren’t stored with more encryption than a simple MD5 hash. It’s secure enough, don’t get me wrong. I’m just surprised that the WordPress developers didn’t opt for more.

Oh well, I hope that helps someone in a pinch.