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 🙂

Ruby – Introduce a new great tool for developers : regular expression builder

Today is a great day because i just finished my little tool name ‘RegexiZ’ (AKA : regular expression with ndthanh.net). this tool will help you to solve your problem with regular expressions – yeah, it’s a big problem when you decided to use regular expressions in your program. every developer know about the magic of regular expression, so let’s get start at https://ndthanh.net/regexiz 😀

note : this program is implemented base on Rails 4

Some people, when confronted with a problem, think
“I know, I’ll use regular expressions.” Now they have two problems.

MySQL – mysqldump database with minimum damage to the server

lightweght I have very large Magento databases with of almost 400 of tables some of which have up to 10GB of data in.  I’ve always had headaches when backing up these databases. Using default mysqldump it quickly spirals the server load out of control and locks up everything… affecting my users. Trying to stop the process can lead to crashed tables and lots of downtime during recovery of those tables. I now use Continue reading

Magento – Remove redundant attributes

Delete_Banner

Some time Magento redundant attributes can be very harmful. for example, AheadWork shop by brand will add aw_shopbybrand_brand attribute to catalog_product, it’s ok when you still use AheadWork module but it can be a big trouble like fatal error on server or producing error messages in your log file when you replace it with another extension. This issue happened because you just removed AheadWork module code from your Magento installation, aw_shopbybrand_brand attribute is still stay in your database. in this article, i will show you a setup script that will remove it.
Continue reading

MySQL general error – 2006 MySQL server has gone away

paperplan

Does this error message scare you ?

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Today we will take a look at it and find ways to deal with it 🙂 . after investigating the issue and google it online, i founded two most common reasons (and fixes) for the MySQL server has gone away (error 2006) are:

Continue reading

Unix – Recursively chmod only directories or files

directories

Have you ever come across the problem of needing to chmod many directories and sub-directories, but you don’t want to touch any of the files? Maybe it’s the exact opposite, or you need to recursively change the permissions on only files with a specific extension. If so, this article is for you

To change permission of all directories to 755, execute this command in terminal

Continue reading

Unix – display a logfile in real time on screen

logfile

Q. I’d like to see my php or apache web server log files in real time. How do I see log file in real time including all incoming logs?

A. You need to use tail command which output the last part of files in real time including all incoming logs to a file.

tail -f file-name command

here are some examples

Continue reading