Tag Archives: PHP

Laravel Blank (White) Screen of Death on Mac OS X

Kept getting a blank screen / white screen of death upon copy-pasting a new Laravel project from a Windows machine to Mac OS X (Mavericks – PHP 5.4). Nothing helped. No errors were shown or logged. Whoops was not showing either. It was probably a permissions issue, but no debugging help.

Got to the bottom of the issue only after installing a fresh copy of Laravel 4.1:

This emitted the following error upon browsing project in the browser:

That was it: permissions issue!

So here is the solution: set permissions of all files and folders in app/storage. So, go to your project root from Terminal, and enter the following:

That’s it!

Installing from Packagist using Composer

If you have Composer already installed, then to install a PHP package from Packagist, such as Generators package for Laravel, type the following on the terminal in your web project directory:

$ composer require ways/generators

You will be asked about the version of the package that needs to be installed:

Please provide a version constraint for the way/generators requirement: 1.0.*

I required the latest, which was 1.0.x-dev; so something like 1.0.* would get the latest one in 1.0 branch.

Composer will install the dependencies first, and then install the required package:

composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  – Installing mockery/mockery (dev-master 28c7769)
  Cloning 28c77695ac5167e533f86e0268c0a83ef1ac693a

  – Installing way/laravel-test-helpers (dev-master 869388b)
  Cloning 869388b555c68c0dc74297eca83893c8500d8221

  – Installing mustache/mustache (dev-master v2.3.1)
  Cloning v2.3.1

  – Installing way/generators (dev-master a04a2c9)
  Cloning a04a2c9cf6704f107f1a4e534d898d46f076d3de

Writing lock file
Generating autoload files
Generating optimized class loader…
Compiling common classes…

That’s it. The package has been installed in your web project. In your Laravel app, it gets installed inside the vendor directory.

PHP 5.4 on OS X Mountain Lion

Installing PHP 5.4 on Mac OS X Mountain Lion from Source

Here is how to install (or update) PHP 5.4 on Mac OS X Mountain Lion from source. This walkthrough is an extension of Upgrading the Native PHP Installation on OS X Mountain Lion. So first follow that, and if you come across any issues during the ./configure part of PHP installation, then come back here. This is what you will get at the end:

PHP 5.4 on Mac OS X

Here are the step-by step instructions that I followed to get PHP installed from source on Mac OS X Mountain Lion:

Step 1: Follow the Yellow Brick Road

Follow Upgrading the Native PHP Installation on OS X Mountain Lion (tutorial 1). Ideally, this link would be the only article you have to go through to setup PHP 5.4 on OS X Mountain Lion. In my case, it wasn’t. So we move to step 2, where I encountered the first error during ./configure part of PHP installation. The rest of this walkthrough assumes that you have followed the walkthrough from the original tutorial up till the ICU installation section, right before the “Installing” heading.

Step 2: Install libpng to tackle: configure: error: png.h not found.

Upon executing the following:

It ended with the following lines:

I tackled this by installing libpng through homebrew (you should have homebrew installed from the earlier step in the original tutorial):

Step 3: Install freetype to tackle: configure: error: freetype.h not found.

Executing ./configure line again ended with another error:

Tackled it by installing freetype:

Step 4: Tackling: configure: error: utf8_mime2text() has new signature …

Executing ./configure again, it threw a new error this time:

This took me the longest to solve! I tried the following:

But that didn’t solve the problem. The error turned out to be related to the PHP IMAP extension, for which, as I found out, we require to compile IMAP from source.

Step 4.1: Compiling IMAP from Source on OS X Mountain Lion

I followed Step 1 from Snow Leopard PHP and IMAP Support article to get IMAP compiled on my Mac (no need to follow the rest of the steps), which made the error in step 4 go away, but introduced a new one.

Step 4.2: Helping OS X find libc-client.a

Now the new error that I received when executing ./configure was:

For this, I got a little help from PHP IMAP support in Mac OS X Lion without recompiling PHP: I executed the following (while in the /usr/local/imap-2007 folder):

This fixed the error.

Step 5: Do you want PHP with International Support?

Yet another error upon executing ./configure. Installing PHP manually on Mac OS X is such a pain!

Turns out that this resulted from a a step I skipped from the original tutorial, which walked through installing ICU for enabling international support. If you are getting this error, make sure you followed that step. However, if you don’t really want international support in PHP on your system, you can remove the –enable-intl option while running ./configure. I did the latter and finally got through the ./configure command!

Milestone Reached: Configured successfully!

Upon successful execution of ./configure, you will see the following:


Oh wait, there is more to do before PHP 5.4 is installed on OS X Mountain Lion.

Step 6: Make PHP

Followed the next part in tutorial 1, which involved running:

The tutorial said that it will take up to 30 minutes, so we need to wait. After a while, the process ended with the following:

This probably means success as far as make is concerned, so I went ahead with the next part of the tutorial. It will also ask you to send the test result to PHP folks and ask for your email address if you choose to.

Step 7: Install PHP

It ended quickly. Looks like everything went fine.

Step 8: Check PHP version to make sure you got everything right!

Let’s check the PHP version:

This resulted in:

Yayy!! Installing PHP 5.4 on Mac OS X, or updating it, was not easy, but in the end you should have PHP updated to version 5.4, just like I did! While doing it, we gained the experience of building, compiling and installing a software from source. It was worth it.


How to Debug PHP Applications with NetBeans IDE and Xdebug on Windows?

NetBeans logo After having tried many IDEs for PHP development, including Eclipse and Komodo Edit, I have found myself the most comfortable and productive with the excellent NetBeans IDE.

You can start building PHP applications with NetBeans right out-of-the-box by simply downloading NetBeans for PHP (version 6.8 is the latest as of this post). Debugging with it requires an additional download of Xdebug.

Here is a quick and step-by-step guide to quickly start developing and debugging your PHP application projects with NetBeans + Xdebug:

1. Download and install NetBeans IDE for PHP.

2. Download Xdebug (it’s a small DLL library file).

Advice: Among the plethora of download links available on that page, let me tell you that you generally wouldn’t want the ‘non-thread-safe’ version, so ignore that; go for the latest non-beta version. I downloaded 5.2 VC6 (32 bit) of Xdebug 2.0.5.

3. Next you need to make changes to php.ini found in apache\\bin folder (the location of your apache folder may vary depending on your installation, look for it).

Find “[Zend]” section in your php.ini file, which should look like the following:


Xdebug is not compatible with Zend Optimizer, so comment out lines 2 to 5 (by prefixing the line with a semi-colon), and add the following lines under [Zend] section heading:


Note: Remember to change the path and filename to match your Xdebug path and version.

4. Restart Apache (if using XAMPP: Open the XAMPP Control Panel and first stop, then start Apache).

5. To verify if Xdebug is configured properly for debugging, create a php file containing this one line:

Save it in your htdocs folder [phpinfo.php], and open it in your browser [http://localhost/phpinfo.php]. If Xdebug is loaded successfully, you should see something like this:

Xdebug info with phpinfo()

That is it! Now you are ready to debug your applications with Xdebug using NetBeans IDE. Simply open your PHP project in NetBeans and press Ctrl + F5 or click Debug project button in NetBeans in the toolbar.

A detailed guide on configuring Xdebug with NetBeans can be found on this wiki: http://wiki.netbeans.org/HowToConfigureXDebug.

Happy coding! 🙂

Web Frameworks: Which one to learn?

Being in the field of IT (Computer Science), it’s necessary to keep pace with the changing landscape, otherwise you would end up rendering yourself obsolete. It’s no different with web development/programming: The landscape keeps changing, either on the user interface front or the browser side or the website back-end.

As of now, we are moving through the era of web application frameworks. That’s the landscape we are surrounded with. Plenty of frameworks have been built during these years broadly categorized under software frameworks, web application frameworks and JavaScript frameworks (or libraries), and plenty more are being developed.

So better learn one now, before you are rendered obsolete.

I am considering the following frameworks:

image image image image Djangoimage

Read more about the most popular web frameworks that I am considering after the jump.

Continue reading