Start PHP builtin server for a Project without Apache

To PHP developer, setting up new development environment is a repetitive job, it’s boring and take time when you want to test something quick on system that’s not yours. luckily, PHP include a built in server out of box from version 5.6 and today i’m going to show you how to execute it.

first, you will need a php project with index.php file. Then use terminal emulator to go to project root and execute this command :

php -S localhost:8080

You can now  access your project at this address on your browser : localhost:8080 , just simple like that.

Default entry point is index.php, but you can access other file.


This is good to see all requests come in or error. Can be used on the fly for quick debugging. hope you find it useful 🙂

Laravel – Change user password with tinker tool

change password

Today just asked myself if i can change user password in Laravel via command line, so things will be easier for us to work with Laravel products. I bet many of you use default Laravel user model (which is good for us in this case). if you do, this article is for you, i found an interesting tool within Laravel command line interface name ‘tinker’

Continue reading

Compiling latest version of PHP on Mac OS X


Mac OSX has a lot of Unix utilities, they’re very useful. You can start using many of your favorite Unix/Linux application out-of-the-box. But when it come to PHP, it’s not as good as PHP on Linux, What you have is an outdated version and you don’t have new features and performance of latest PHP .In this article, i’ll show you how to upgrade php on your Mac to latest version.

Continue reading

Magento – Optimize your webshop


Recently, i have many works that focus on Magento optimzation, that explains why i have many optimization related articles stay close to each other :D.

Today i’ll introduce you another techniques belong to Magento itself, it means you can do it with only source code and admin dashboard. there’re two sections, first one is about configuration, and second one is about frontend. i hope you will enjoy it.

Continue reading

Magento – Fix integrity constraint violation issue


Sometimes, you face database issues like this ‘integrity constraint violation: 1062 Duplicate entry ‘100000001’ for key’ . if you are not familiar with Magento, may be you will feel blind (like i was), debugging won’t go smoothly as usual.

After studying Magento deeper to its core, i found that Magento numbering system depends on a table called ‘eav_entity_store’. this table stores increment ids of many entities from Magento.

Continue reading

Five common PHP design patterns


Design patterns were introduced to the software community in Design Patterns, by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (colloquially known as the “gang of four”). The core concept behind design patterns, presented in the introduction, was simple. Over their years of developing software, Gamma et al found certain patterns of solid design emerging, just as architects designing houses and buildings can develop templates for where a bathroom should be located or how a kitchen should be configured. Having those templates, or design patterns, means they can design better buildings more quickly. The same applies to software.

Continue reading

Magento – fix the 404 error on the admin dashboard

When I changed the URI to access to my dashboard, when I logged in again, there was a 404 error on the admin dashboard. It seems is something related to permissions and can be easily solved executing the following commands:

find . -type d -exec chmod 755 {} ;
find . -type f -exec chmod 644 {} ;
chmod o+w var media -R

If this doesn’t work, maybe the login form is not redirecting correctly. In that case we need to change the action url in the app/design/adminhtml/default/default/template/login.phtml file. Look for the «form» start tag:

<form method="post" action="" id="loginForm">

Change it to:

<form method="post" action="<?php echo $this->getUrl('adminhtml') ?>" id="loginForm">

that’s it, you have you familiar dashboard back 😀

Design patterns which are used in Magento

A design pattern in architecture and computer science is a formal way of documenting a solution to a design problem in a particular field of expertise.

from wikipedia.


$product = Mage::getModel(‘catalog/product’);


$category = Mage::getSingleton(‘catalog/session’);
Continue reading