PHP

15 methods to boost your PHP based website’s performance

PHP is great for writing quick dynamic stuff for your website. Just a couple of lines of code can be written in 2 mins to insert or retrieve data from db. But with ease there is also some pain… the downside is that each request for a dynamic page can trigger multiple db queries, processing of output, and finally formatting to display on browser. This process can eventually be slow on larger sites or slower servers.

In this article, we’ve put together the list of caching plugins and techniques which can be used to improve your website performance.


Continue reading »


20 jQuery Utilities For A Smashing Website

Webdesigners create and design a whole lot of widgets and utilities to make a website more appealing. Here, I have collected the best jQuery Utilities that will help every web designer and web master to build a beautiful yet fully loaded smashing website.

1. Real Person jQuery Plugin

This plugin is designed to help overcome automated form submission by requiring a real person to identify text made up of dots. The entered value is compared on the server with the generated value to determine whether processing should continue.


Continue reading »


Zen Coding: A Speedy Way To Write HTML/CSS Code

How much time do you spend writing HTML code: all of those tags, attributes, quotes, braces, etc. You have it easier if your editor of choice has code-completion capabilities, but you still do a lot of typing.

We had the same problem in JavaScript world when we wanted to access a specific element on a Web page. We had to write a lot of code, which became really hard to support and reuse. And then JavaScript frameworks came along, which introduced CSS selector engines. Now, you can use simple CSS expressions to access DOM elements, which is pretty cool.

But what if you could use CSS selectors not just to style and access elements, but to generate code? For example, what if you could write this…


Continue reading »


10 Super PHP codes to handle HTML (for Web Developers)

1. Object HTML

A set of classes that will allow you to build HTML documents completely w/ objects in PHP. This is only the most basic layer but it is easy to build onto.

Download Now

2. OO HTML Table Generation

Automatic generation of HTML for table.
- Colspan, rowspan, table style, column style, cell style, and data style may all be defined.
- OO interface
- Simple but effective

Download Now


Continue reading »


Unix manual pages for PHP functions

Did you know that unix manual pages for PHP functions and methods existed?

For a while I had vim configured to run reflection when I hit “K“, but after the PHP documentation team released unix manual pages for PHP I now get the manual page in all its glory; function description, parameter descriptions, return values, examples, notes, see also and everything you are used to see from the online manual.
Its awesome.


Continue reading »


Converting your PHP app to MySQLi prepared statements

These are the steps you need to take to convert to prepared statements.

Step 0. PHP 4 is dead. Upgrade to PHP 5

All of the code in these samples is PHP 5 only. I will be using SPL and MySQLi, which are installed primarily on PHP 5.2.x installations. PHP 4 cannot be made safe, so it’s time to upgrade. This is non-negotiable in my view.

If you’re using register_globals, you have to stop. Do not use a function to register them for you in PHP 5, it’s time to do proper input validation. This will actually take you longer than converting all your queries to prepared statements.


Continue reading »


Accepting the Google OpenID with PHP OpenID

If you are using the PHP OpenID library (which is also used by my OpenID component for CakePHP), it is possible that you get an “Invalid OpenID” error when you try to login with the Google OpenID (https://www.google.com/accounts/o8/id), or any other OpenID that uses “https”.

In this case, the following steps might help to fix this issue:

* Ensure you have Curl and OpenSSL installed
* Enable the Curl and OpenSSL extensions in your php.ini (on Archlinux this file is found in /etc/php/):

extension=curl.so
extension=openssl.so

* Restart your web server

Now the error message should disappear and you should be able to log in with the Google OpenID.


20+ Tools for Quick and Clean Code Development

Developing websites is much more than just a pretty face, and depending on what typed of features you’d like to implement on the site, there’s a lot of coding that goes into it. Many times designers turn to a WYSIWYG tool, however tools of that sort are more limited to advanced code. Being able to code a site using a variety of tools lets you simplify the coding process while you take a big bite out of saving time.

Below we’ve hand picked 20+ Tools for Quick & Clean Code Development that will help you code much faster and in an efficient manner.

AJAX

MiniAjax


Continue reading »


Top 20+ MySQL Best Practices

Database operations often tend to be the main bottleneck for most web applications today. It’s not only the DBA’s (database administrators) that have to worry about these performance issues. We as programmers need to do our part by structuring tables properly, writing optimized queries and better code. Here are some MySQL optimization techniques for programmers.

1. Optimize Your Queries For the Query Cache

Most MySQL servers have query caching enabled. It’s one of the most effective methods of improving performance, that is quietly handled by the database engine. When the same query is executed multiple times, the result is fetched from the cache, which is quite fast.

The main problem is, it is so easy and hidden from the programmer, most of us tend to ignore it. Some things we do can actually prevent the query cache from performing its task.

// query cache does NOT work
$r = mysql_query("SELECT username FROM user WHERE signup_date >= CURDATE()");

// query cache works!
$today = date("Y-m-d");
$r = mysql_query("SELECT username FROM user WHERE signup_date >= '$today'");

The reason query cache does not work in the first line is the usage of the CURDATE() function. This applies to all non-deterministic functions like NOW() and RAND() etc… Since the return result of the function can change, MySQL decides to disable query caching for that query. All we needed to do is to add an extra line of PHP before the query to prevent this from happening.

Continue reading »


PHP Development: Turn Your Website into Multi-Featured Web Application

Are you looking for developing a web application with charming features which have a range integrated database?
PHP is one of the best technologies for web applications integrated with database. PHP is an open source, secure and popular web development framework, which has taken the web application development methodology to the new heights. PHP is a fully blown infrastructure, environment or framework for developing any type of web applications in real time. PHP is a very popular because it is proving to be a serious threat to the monopoly of .Net and Java in the other field of application development.

PHP can be a hard nut to crack when it comes to search engine optimization. PHP developers encounter a lot of technical issues while creating PHP scripts based on SEO guidelines. The web pages needed to be constantly, and manually, modified. The web development industry was lacking such web sites that were dynamic and would update automatically. The Born of PHP as a web application development language ended up this issue and the era of dynamic (or auto updating sites) has risen since the acceptance of PHP as a web application development language. Unlike ASP / ASP.Net and JAVA, PHP doesn’t require any specified framework to build a web application. PHP based web applications can be developed using any IDE on any platform with any local host installed. This means that unlike .net framework for asp applications and JVM for java based applications PHP doesn’t require any strict or specified framework or environment and this is one of the best benefits of PHP.
Continue reading »