Installing Phalcon in Ubuntu

Phalcon is a PHP Framework I wanted to play with. I have recently switched one of my PC from Windows 8.1 to a Linux distro – for development and everyday use. Slowly but surely I’m finding alternative software and loving it. I’m only going to use Windows for gaming. For now, I will be using Ubuntu 14.04 LTS. The version of Phalcon for this post is 1.3.1.

There is a little guide that can be found on their website that helps install Phalcon, but just like Laravel’s instructions, it’s somewhat incomplete. Which is why, for Laravel, I had to post an add-on guide to their guide. If you follow that guide, you will first run into problems in the compilation section where they want you to run the install command. It will complain about pcre. You can read more about the error athttp://stackoverflow.com/questions/22555561/error-building-fatal-error-pcre-h-no-such-file-or-directory. The solution is also there.

Once you install libpcre3-dev, you can continue with the install. The next trouble you may run into is trying to load the phalcon extension. Again, the guide is a little vague with its instructions. The solution to this is found athttp://codingtip.blogspot.com/2014/03/install-phalcon-phalcon-developer-tool.html.

	Create phalcon.ini file in /etc/php5/apache2/conf.d/phalcon.ini add : extension=phalcon.so in this file.

Hope this helps you. I get lost easily when I play with new things. If loaded correctly, you should see this section in your php.ini.

phpinfo

Setting up Laravel 4 on Linux Mint 16

I’ve been curious about Laravel and wanted to set up a virtual machine to get an environment for it. I will go over what I used and how I managed to finally get the environment working. Here is a list of what I will be using. I am including the version numbers just to add more detail. These are the versions I used at the time of writing this post. Terminal will be used to type the command and is assumed you are at your home directory.

I will be installing LAMP on Linux Mint by using

sudo apt-get install lamp-server^

This will install the following.

  • Apache 2.4.6
  • PHP 5.5.3
  • MySQL 5.5.35

You can install phpmyadmin if you want but those are the 3 main components. Next, head on over to the quick start guide http://laravel.com/docs/quick. You might ask, why I’m posting this when Laravel already has a tutuorial. Well, I ran into many issues and I wanted to take note of them and the solutions I found. So I’ll be referring to their guide.

First thing we’ll need to do is install composer. To install composer, you will use curl. If curl is not installed, then use the following command.

sudo apt-get install curl

You will also need json extension for PHP.

sudo apt-get install php5-json

If you have curl installed, then download composer with this command.

curl -s http://getcomposer.org/installer | php

Once download is completed, it will tell you where it downloaded and how to use it. We will move and rename composer.phar to composer and move it to /usr/local/bin.

sudo mv composer.phar /usr/local/bin/composer

You can check to see if it’s working by typing the following.

composer about

It should give you the description of composer. Now that you have composer installed, we can install Laravel. According to their guide, you need to download it from http://laravel.com/laravel.phar. We’re going to use terminal to download it, then just like composer, we’re going to move it to /usr/local/bin.

wget http://laravel.com/laravel.phar
sudo mv laravel.phar /usr/local/bin/laravel

Update: 2015-04-22: The file laravel.phar is no longer available. Essentially, you don’t need it. Composer is all you need. Thanks to @rohantapiyawala for giving me a heads up.

I will be storing my projects in the ~/Sites folder. For this tutorial, I will call the project apple. So this will sit in ~/Sites/apple.

mkdir ~/Sites
cd ~/Sites
composer create-project laravel/laravel apple --prefer-dist

You may get an error regarding the mcrypt PHP extension. The error looks like this.

laravel_mcrypt_errorlaravel_mcrypt_error

Install the extension.

sudo apt-get install php5-mcrypt

Check if it is enabled.

php --ri mcrypt

If it’s not enabled/present then do the following.

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt
sudo service apache2 restart

Delete the apple project and use composer to create it. This time you shouldn’t get the mcrypt error. I found the solution at http://stackoverflow.com/questions/19775012/my-composer-wont-update-completely-with-laravel-4-it-gets-stuck-with-artisan.

rm -rf ~/Sites/apple
composer create-project laravel/laravel apple --prefer-dist

If you look inside the ~/Sites/apple directory, you will see public. This is the “public_html” of the project. Just set Apache virtualhost for that folder and you’re done. My file is located at /etc/apache2/sites-available/apple.conf and it looks like this…

	<Directory /home/sherwin/Sites/apple>
	Options Indexes FollowSymLinks
	AllowOverride All
	Require all granted
	</Directory>
	ServerName apple.local
	ServerAdmin webmaster@localhost
	DocumentRoot /home/sherwin/Sites/apple/public
	ErrorLog /home/sherwin/Sites/apple/error.log
	CustomLog /home/sherwin/Sites/apple/access.log combined

Next you need to enable the new site and restart Apache.

# enable new site conf
sudo a2ensite apple.conf

# restart apache
sudo service apache2 restart

If you get a blank screen, you may need to give app/storage different permissions. The article athttp://stackoverflow.com/questions/20678360/laravel-blank-white-screen explains more.

# Group Writable (Group, User Writable)
sudo chmod -R gu+w app/storage
# World-writable (Group, User, Other Writable)
sudo chmod -R guo+w app/storage

You should now be able to load http://apple.local. If it works, you will get the Laravel logo and “You have arrived.” text. Coming from Codeigniter, I felt there is a lot more tasks just to get Laravel to work. It somewhat discourages me to continue experimenting but I’ll give it another chance. It’s my curiosity that drives it.

Upgrading my iMac MB324LL/A

My 320GB hard drive is starting to fill up on my iMac so I decided to get a 1TB hard drive. I knew opening the iMac is going to be a pain. I’ve seen videos from YouTube on how to open the previous plastic models and it looked hard. Nevertheless, I needed to upgrade my hard drive and I want someone else to do it. Besides, I wanted to know how to do it and do it myself. So the first thing I needed to do is look for videos on YouTube. I kept getting the plastic iMac model but kept searching. I found 2 pretty good videos: by lexusnut and by Zenn3k. Those were my starting point.

Update: their videos on Youtube are no longer there. I’ll keep their usernames in the post just to show credit.

It took my cousin and I two hours to finally access the motherboard area. I cannot stress enough on how careful you must be. Apple has placed wires in many areas where if you lift something quickly, you may pull it out of place or unplug it – leading to damaging your device. We documented the process and uploaded it on YouTube to help others.

My 320GB hard drive is starting to fill up on my iMac so I decided to get a 1TB hard drive. I knew opening the iMac is going to be a pain. I’ve seen videos from YouTube on how to open the previous plastic models and it looked hard. Nevertheless, I needed to upgrade my hard drive and I want someone else to do it. Besides, I wanted to know how to do it and do it myself. So the first thing I needed to do is look for videos on YouTube. I kept getting the plastic iMac model but kept searching. I found 2 pretty good videos: by lexusnut and by Zenn3k. Those were my starting point.

It took my cousin and I two hours to finally access the motherboard area. I cannot stress enough on how careful you must be. Apple has placed wires in many areas where if you lift something quickly, you may pull it out of place or unplug it – leading to damaging your device. We documented the process and uploaded it on YouTube to help others.

So now I got the new 1TB hard drive installed. How do I get my old system on the new drive? There are 2 ways to do this. The first way is to use Time Machine (if you actually did use it). You can install a fresh copy of Leopard on the new hard drive. After installation, you get an option to use a Time Machine back up to restore. I’ve tried this but since I have over 200GB of data, my iMac ends up sleeping while trying to load the data to restore.

The second option is the image the old hard drive and restore it on the new one. This option took me about a day to complete. What you will need is an external hard drive, your old hard, and the new hard drive. If you image your old drive before installing the new one, you don’t need a second external enclosure. The first thing you’ll do is to boot your computer using the Leopard DVD. Open Disc Utility on the Leopard DVD. Do not do this while booted on the hard drive. It’s possible that it will not work because the drive you are imaging is in use. The external hard drive is where you will save the image file. Once finished, restore the image onto the new hard drive. That’s pretty much a brief summary of what I did.

I did run into some errors while formatting the new hard drive. This post helped me outhttp://macosx.com/forums/hardware-peripherals/290989-disk-utility-problem-erasing-large-external-hard-drive.html.

The image/restore process took most of the day. It may be quicker or longer for you, depending on the size of the data. Make sure you take any necessary precautions before working on your expensive Apple hardware 😉

New upgrades for my Asus EEEPC 900A

After a few days with my netbook, I’ve decided to buy some upgrades to better my experience with it.

Here’s the video I posted on YouTube on installing the ram.

I didn’t bother posting another video for installing the new SSD drive because it’s fairly the same procedure as the ram upgrade.

Here’s the video where I got the idea to use the Case Logic HDC3 case.

Cost for all the upgrades were around $100. With the price of my netbook, it still cost less than the average startup price for a netbook.

Installing PEAR on Godaddy shared accounts

I recently found out how to install PEAR on a Godaddy shared hosting account.

  1. Visit http://pear.php.net/go-pear. Save the text displayed onto your desktop and name it go-pear.php. Upload this to your server. If you’re hosting multiple domains on the account, it’s best that you should upload this file in your root folder. Run this file on your browser and follow the on-screen instructions.
  2. After completing the installation, it is time to edit your php.ini file. If you are running PHP4, there should be a file in the root directory called php.ini. If you are running PHP5, there should be a file in the root directory called php5.ini. If not, create one and add the following: include_path = “.:/usr/local/php5/lib/php:/home/content/s/a/m/sample/html/PEAR”. Keep in mind that /s/a/m/sample is just an example. Doing this will ensure that every page, you create, will look in the PEAR directory so that you it will use the installed packages.
  3. This installation will include Pear_Frontend_Web which is the web-based admin interface. It may have created an index.php file in the directory where PEAR is installed (root). If not you can get a copy from PEAR/docs/PEAR_Frontend_Web/docs/index.php.txt. I would suggest creating a folder called pear_admin in the root directory and storing this file there. If you didn’t install PEAR in the root directory, you may need to edit this file accordingly.
  4. You will need to create a .htaccess and .htpasswd file in the same directory as the index.php file. An example of how the .htaccess file should look as follows:
    AuthUserFile /home/content/s/a/m/sample/html/pear_admin/.htpasswd
    AuthType Basic
    AuthName “Web-based PEAR Frontend”
    Require valid-user

    An example of how the .htpasswd file should look as follows:

    admin:cGyUX9QugYMgE

    This will create “admin” as the user name and “password” as the password. You can generate your own by going to this link – http://www.htaccesstools.com/htpasswd-generator/

    Be aware that files beginning with a dot are invisible. You may have to edit your settings on the FTP app you’re using so that you can see them.

Once the files are created and saved, you can now go to http://your-domain.com/pear_admin/index.php. It will ask for the user name and password. Once you are logged in, you can now manage Pear via web browser. That’s it! Now you can run PEAR on a shared account from Godaddy. One less complaint 🙂