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 🙂

Magento – Adding custom variables to Magento Static Blocks

I’ve been asked to customize the front page of a magento store. The client wanted the ability to specify a set of variables that can be used in CMS static blocks so static blocks can be a little more dynamic.

By default, the standard magento CMS static blocks don’t provide access to the custom variables. so I thought I was going to have to build an extension to pass the variables in. However after a little bit of finding, I found that this functionality is available as standard in Magento, you just need to do it properly.

Continue reading

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

.gitignore generator for Magento

Git is a distributed revision control system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. it’s important for many projects and Magento is not an exception. for many beginners or even experienced developers, a good .gitignore file is not always in their mind, this is source of many sins in the future to other developers who get in the line of the same project later.

i created a bash script and have been using it for awhile. You can generate a good .gitignore file from now on and stop worrying about git related issues in the future. you can find the script below

Continue reading

Mac – Import sql.gz file with p7zip

I have been having problem with Mac extract program for gz files for a long time . and it caused me trouble to import compressed database dump from server . this is the mysql dump command i often use


mysqldump -u USER -p --single-transaction --quick --lock-tables=false DATABASE | gzip -9 > OUTPUT.gz

if you’re using Mac to extract zip and import database, you may see corrupted database or broken file in some cases. today, i’m sharing with you a good method to import compressed database with sql.gz at the end.

Continue reading

Magento – Secure your webshop

secure magento

Recently , i have been working on security aspects of Magento and Server (centos,ubuntu ..) to help my clients secure their webshops, so i have prepared a security plan . perhaps you can find useful information here .

Continue reading

PHP – Crawl websites from command line interface

spiderman cover

Recently, i wrote a new crawler script to warn caches on some Magento websites. Today i’d like to share it with you, because i wrote it in a way that works with many websites other than Magento and many platforms.

You can see the help content by running the crawler in command interface like below, make sure there is no sitemap.xml file or you have -help option as parameter in your command line.

Continue reading