How to run PHP Program, CODE or File on Your own Computer?

Summary: Easiest way to install & run PHP on Your Own Computer: Run PHP using XAMPP.

To begin Programming in PHP or to check an existing PHP site or script on your own computer, the very first question you'll face is:

How to run PHP CODE or any File ending with .php extension on My Own Computer? What's the easiest way?

A PHP Program is the result of many lines of PHP CODE & often includes many PHP files. Also, since PHP is a Scripting Language, CODE written in PHP files are often called PHP Scripts. These are all interchangeable words. So don't get confused by these terms.

A Short Introduction:

The easiest way to install & run PHP on your own computer is using a software like XAMPP.

Continue reading "How to run PHP Program, CODE or File on Your own Computer?"

PHP include vs. include_once vs. require vs. require_once

Learn key differences among the PHP constructs: include vs. include_once vs. require vs. require_once & use them correctly.

PHP programmers regularly use the functions (or more appropriately known as language constructs) like include, include_once, require and require_once to insert useful files in the flow of execution. Although these constructs are used quite interchangeably, there are actually significant differences among them. Many programmers don't know well enough about these differences. I hope this post will help them towards a better coding practice.

Continue reading "PHP include vs. include_once vs. require vs. require_once"

CPanel Addon Domain without Subdomain

It's a very common problem in shared web hosts, check it out and optimize your website by implementing it!

Most of the shared web hosts that allow hosting of multiple sites from a single hosting account (like Hostmonster, Hostgator etc.) has a common structure. You'll have one main website or domain and all the other websites or domains will be added as Addon domains from cpanel. This way you can host multiple websites from a single hosting account. However, this approach has a problem. With each Addon domain created from cpanel, you also automatically get a subdomain (almost in all cases). Now, the challenge is to using the Addon domain, without the auto created subdomain. This may be important for your website optimization.Since, most of the times, they enable this Addon domain option in cpanel, by creating a subdomain of the main site and then pointing that subdomain to the newly created Addon domain. So in a way, the Addon domain is joined together with the subdomain, and doesn't work without it.

Continue reading "CPanel Addon Domain without Subdomain"

WordPress: Disable Smart Quote Auto Correct

WordPress: CODE / Commands from your post doesn't work after COPY/PASTE? Learn how to fix it easily & smartly! Hint: Disable Smart Quotes or Curly Quotes.

CODE or Commands written in your WordPress Site doesn't work after COPY/PASTE? Straight (single and double) Quotes are automatically converted to Curly Quotes or Smart Quotes? Here is why it happens & How to Fix it:

Continue reading "WordPress: Disable Smart Quote Auto Correct"

WordPress blog URL change

The easiest and safest way to change WordPress blog URL.

Few days ago I've changed my WordPress blog hosting from CirtexHosting to HostMonster. I've used CirtexHosting for 2 years and HostMonster for more than a year, mainly for development purposes. So perhaps, within a few days, I'll post a review about their performance. In short, both of them provide very good web hosting services. However, this post is not about the review, it's about the temporary problem I've faced while shifting this blog hosting.

Continue reading "WordPress blog URL change"

Masking Test & Input Fields in Flash (Example)

Solution to a common problem in Flash text/font. Check it out!

This is the solution (with example demonstration) to Flash Text / Font masking problem. If you came to this page directly, then I suggest you read my Previous Post, which speaks about the problem. Otherwise follow the Tutorial.

Continue reading "Masking Test & Input Fields in Flash (Example)"

Masking Test & Input Fields in Flash

A common problem in Flash involving text and masking. Check it out!

Normally, mask setting in Flash IDE don't work for dynamic TextField and TextInput components. With default settings, you'll not be able to see the text through the mask. People using masked layers from Flash IDE often fall into this problem. One stupid solution to this problem is not using mask at all. However, if you want to implement something like custom scrolling, sliding etc. then most of the time you'll need to use mask.

Continue reading "Masking Test & Input Fields in Flash"

Use PHP MySQL date format correctly

Learn how to handle PHP and MySQL date formatting correctly.

If you ever try to format date in PHP and MySQL, using date (datetime or timestamp) value directly from MySQL to PHP date() function, then you'll get a Notice level error, something like this:

Notice: A non well formed numeric value encountered in ... .. .

Additionally, PHP date() will always return January, 01 1970 if MySQL date is directly used. It means, there is a difference between date in PHP and date in MySQL (i.e. they are not compatible). PHP date function accepts Unix Timestamp,  which is different from MySQL date types (DATE, TIME, DATETIME, TIMESTAMP etc.)

Continue reading "Use PHP MySQL date format correctly"