Fix Strange “Headers already sent by” in Line 1 PHP File

"Cannot modify header information - headers already sent by" error is most common PHP error happen when we develop a web application. Usually when we want to redirect or send cookie. I used to get that warning a lot long time ago. But since i standardize my PHP code, it doesn't happen for a while now, until last night.Yesterday night i was fixing somebody else code and audit the performance as well as the security. But when testing it, i got very strange error, the error was "Headers already … Read more...

PHP Script To Test Send Email

Sometimes sending email could be pain in the ass for some server. Especially if it is a share hosting that has blacklisted IP, and all the emails it send either go to spam box or doesn't deliver at all. As one of my services, is deploy a web application and most of the time sending email from my staging server is completely fine, but not in the client hosting server.So because i'm checking it over and over, in my free time i create a simple script to send email from the server. If you are … Read more...

Jump Start Your Web Application With PHP Composer

If  you are a web developer and love to use PHP, i bet you have heard about composer. Composer is dependency manager for PHP. So what is dependency means? In developing a web application you may need to use one or more libraries. In my case i often use these libraries: monolog, slim, laravel, debug helper, and laravel. Without composer it would take me hours just to do the environment setup. With composer i just need to define a composer.json file, and composer will handle the rest, … Read more...

Web Development Using PHP, MySQL and Flash

PHP and Adobe Flash (formerly Macromedia Flash) are popular scripts used for creating web pages and online multimedia presentations. The two scripts can be combined to create dynamic, interactive pages similar to those used by big movie studios to promote their latest film releases.PHP (Hypertext Preprocessor) is similar to the standard static HTML script and it recognizes the elements of HTML, but it also uses active server-side processing in creating dynamic pages. PHP can deliver varied … Read more...

Snippet Code To Benchmark Your PHP Script

Testing is one of common task for programmer. In every development phase, testing is need to be done before moving to next phase. There are a lot of testing technique. One of them is benchmarking, to test script/code performance. Benchmark test result can be used to optimize the code/script.As in PHP you can get how long your server took to parse and execute your code. Here is the simple snippet code to get the execution time:This simple code will help you discover bottlenecks in … Read more...

Install And Configure Nginx, PHP, MySQL On Ubuntu

Nginx is simple webserver yet powerful. It is widely know for stable webserver. If it is well configured, nginx rarely have spike in the cpu load and have low memory consumption. Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption.In this article i want to share how to install and configure your Ubuntu server to use Nginx as web server, PHP5 support (using fastcgi) and MySQL support.Open your ssh terminal. Install … Read more...

Install Or Update PEAR On Xampp For Windows

PEAR is short for “PHP Extension and Application Repository” which provide a repository for PHP community extensions that will make your PHP installation more powerful and easy to develop web application. The project that founded by Stig S. Bakken in 1999 was to promote the re-use of code that performs common functions. The project seeks to provide a structured library of code, maintain a system for distributing code and for managing code packages, and promote a standard coding style.The … Read more...

Image Watermarking Using PHP

There are someways to protect your copyrighted images. One way is use watermark image so when someone copy your image, it is hard to remove the watermark and they cannot use it for their own benefit without asking your permission. In other words, digital image watermark is one way of anti piracy technique to protect your image copyright.There are 2 types of digital image watermark, visible and invisible watermark. Visible watermark is embed your digital sign or logo to your original images. … Read more...

[TIPS] Convert Your Numbers To Human Readable Format

Sometimes your code produce a large numbers which is hard for user to read it. For example 17753392783 bytes or 18293753038 unit. For human eyes, it is easier to get 17MB or 1 million rather than lot of numbers.I write this as quick tips for you, in case you want to convert your data to human readable format. I do this in PHP, for other programming language you can get the algorithm and convert it to your own language:Usage:Thank you for read this article. Good luck and have a … Read more...