Tag Archives: PHP

PHP – How to Install Apache 2.4 with PHP 5.6 on Windows

This article represents instructions on what’s needed to be done to install Apache 2.4 with PHP 5.6 on Windows (64-bit). Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Following are the key steps/points described later in this article: Install Apache 2.4 Install PHP 5.6 Configure Apache 2.4 for PHP Configure PHP 5.6 Test Install Apache 2.4 This step looks to be obvious. However, after I am done with the entire installation, it looked to be a bit tricky especially when you got 64-bit Windows. If you go to website, http://httpd.apache.org, you are taken to download page for win32 …

Continue reading

Posted in PHP, Web. Tagged with .

Top 10 PHP Code Review Tips

php_code_review_best_practices

This article represents top 10 areas to consider while you are taking up the task to do the code review of a PHP project. The other day, I had a discussion with one of the PHP senior developers who asked me about where to start on the task related with reviewing a PHP web application and, we brainstormed and came up with the list. Interestingly, apart from few, most of them can be pretty much applied to applications written with other programming languages as well. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Following are the key points described later …

Continue reading

Posted in PHP, Software Quality. Tagged with , .

Why Facebook’s Hack May Fail to Fly With PHP Developers?

Well, for those innocent souls, I must make it clear that the title of this article has no intentions to point out that Facebook is hacked or so? This is actually about the new programming language, HACK, that Facebook officially launched few days back. Overview of Hack Language Before I go on to write further, I must thank the Facebook engineering team to have rightfully identified some of the short-comings of PHP programming language and tried to present solutions to them using Hack programming language. However, while I was going through the changes that they made by adding new features to PHP and made it as Hack language, I wondered whether …

Continue reading

Posted in News, PHP. Tagged with .

How to Debug PHP Code?

How to Debug PHP Code

[adsenseyu2] If you have started on PHP programming and looking out for tips and techniques on how to debug PHP code, following may help you get started: var_dump command: var_dump command helps one to explore whats stored in arrays and objects. Following is the sample code: <?php $a = array(1, 2, array(“a”, “b”, “c”)); var_dump($a); ?> echo command: You could as well use the echo command to debug php program flow. <?php $foo = “foobar”; echo “foo is $foo”; ?> Configure Xdebug with Zend Studio or Eclipse PHP IDE: If you are tired of var_dump or echo commands, and write PHP code using IDE such as eclipe-php or Zend Studio, …

Continue reading

Posted in PHP. Tagged with , , .

PHP Code for Avoiding XSS Attacks

xss vulnerability

[adsenseyu2] Before we go and discuss the PHP coding tips and techniques to avoid Cross-site scripting (XSS) attacks, lets try and understand quickly what is XSS attack. XSS is a Web-based attack performed on vulnerable Web applications which ends up victimizing the end user rather than the application itself. In these attacks, malicious content is delivered to users primarily using JavaScript. The XSS attack happens when the web applications accepts the input from the end user without validating it. In XSS attack, the malicious code executes in the context of the victim’s session, allowing the attacker to bypass normal security restrictions. There are multiple good web pages to read about XSS …

Continue reading

Posted in Application Security. Tagged with , , .

PHP Code Smells and Best Practices

As application in PHP can be written in object oriented manner, most of the code smells found in the world of object-oriented programming also stay valid for PHP. Recently, I happened to do a code review of a PHP project and wanted to share some of the areas which one would want to pay attention to: Naming methods using Camel Case: It is always helpful to write method names in camel case as it is easily readable. For example, instead of writing method names such as “searchurlAction”, one could write “searchUrlAction”. Software quality characteristic impacted in “Usability“. Long Methods: One may want to avoid large method as these methods become …

Continue reading

Posted in Code Review, PHP, Software Quality. Tagged with .

YII framework for faster PHP web application

If you have been looking for developing a web application in a quick manner, then, YII is surely a right choice. YES IT IS! What are some of the important characteristics of yii framework? 1. It is very lightweight. 2. It is based on MVC framework. 3. It comes with a user interface tool which helps in creation of models, views and controllers. 4. It has support of some real good UI framework such as getyiistrap.com, yii bootstrap, yii wheels. 5. It comes with a support of a set of extensions that can be used to include new features quickly in no time. 6. If you love writing code based …

Continue reading

Posted in Software Quality. Tagged with , , .

How to Configure XDebug Debugger for Zend Studio

I have tried to configure many a times, Zend studio with XDebug due to various reasonss, most common being my computer getting crashed. And, everytime, I found myself reinventing the wheel after I got exhausted to figure out if I noted the configurations somewhere. This blog is for me to refer back whenever my laptop crashes again and I have to reconfigure Zend Studio, PHP and XDebug. Following entities will change: Downloading of XDebug DLL and placing the same in ext folder of php installation PHP INI file Zend Studio Debug Preferences Lets go over each one of them in detail: Download relevant XDebug dll from thos page. http://xdebug.org/download.php. The …

Continue reading

Posted in Debugging. Tagged with , , , .