Archive for the 'PHP' Category



Create an RSS Reader Application

Sunday 10 June 2007 @ 9:51 pm

In this article we will create an application that uses the concepts RSS reader. So let’s go straight to the coding.

The Application

The layout of the application is going to be very simple: A navigation bar on
the left and a display area in the center. The display area is were we are going
to display all the output of the code. I’ve not used any CSS in this
application. I’ve instead opted to use HTML formatting to keep things simple.

As for the actual functioning of the application, we are going to use only
one page to execute all the code. This is because it reduces the amount of
processing power required to run the application. As a result, it makes program
execution faster and reduces coding time. Continue Reading »
Create an RSS Reader Application

«  « 

Technorati Tags:




PHP 5.1.3 Released

Tuesday 2 May 2006 @ 2:25 pm

The PHP development team is proud to announce the release of PHP 5.1.3. This release combines small number of feature enhancements with a significant amount of bug fixes and resolves a number of security issues. All PHP users are encouraged to upgrade to this release as soon as possible. Some of the key changes of PHP 5.1.3 include:

  • Disallow certain characters in session names.
  • Fixed a buffer overflow inside the wordwrap() function.
  • Prevent jumps to parent directory via the 2nd parameter of the tempnam() function.
  • Enforce safe_mode for the source parameter of the copy() function.
  • Fixed cross-site scripting inside the phpinfo() function.
  • Fixed offset/length parameter validation inside the substr_compare() function.
  • Fixed a heap corruption inside the session extension.
  • Fixed a bug that would allow variable to survive unset().
  • Fixed a number of crashes in the DOM, SOAP and PDO extensions.
  • Upgraded bunbled PCRE library to version 6.6
  • The use of the var keyword to declare properties no longer raises a deprecation E_STRICT.
  • FastCGI interface was completely reimplemented.
  • Multitude of improvements to the SPL, SimpleXML, GD, CURL and Reflection extensions.
  • Over 120 various bug fixes.

Further details about this release can be found in the release announcement and the full list of changes is available in the PHP 5 ChangeLog.


« 

Technorati Tags:




Installing PHP under Windows

Friday 17 March 2006 @ 8:19 am

To configure Apache the file we will be editing is httpd.conf. Despite the extension this is just an ordinary text file; so open it in notepad for editing either by navigating through the folders (C:Program FilesApache GroupApache2confhttpd.conf) or via the shortcut on the Start menu (Start > All Programs > Apache > Config > Edit httpd Config File).

Apache will treat any lines starting with a hash, or pound, sign (#) as comments, and will ignore them, so a good way to test a setting would be to comment out the old line with a ‘#’ and type your new setting. That way if you make any mistakes it will be nice and easy to go back to the way things were (delete the new line and uncomment the old one.) There will be many lines commented out, much of it will be text explaining various bits and pieces to you, you should read the first few paragraphs (before Section 1). This should explain a couple of points about directory paths, and different slashes. If there is something you don’t understand, don’t worry as I will be taking you through it all. Remember if you mess up big time the default configuration settings are stored in a backup file (httpd.default.conf). If there are any lines that I don’t talk about, don’t change them unless you know what you are doing. Finally remember, none of these changes will be apparent until Apache is restarted.
I would recommend changing one line at a time, saving the file and testing it by clicking start > All Programs > Apache > Configure > Test Configuration. If you briefly see a DOS (Command Line) box that disappears, then everything is ok. If the box stays it will tell you where it found an error.

Let’s move on to the various directives (configurations/options).

Line: Listen 80

This tells Apache which port to listen for requests on. The default is port 80. If you change the port from default, for example to 8080 or 8008 (both common choices), then any URLs must be validated (e.g. http://www.localhost:8080/ or http://localhost:8080/test.php). As you could imagine typing this for every URL would get quite annoying, quite quickly, so unless you have a real reason to change it, such as IIS compatibility issues, don’t.

Line: LoadModule

The Various LoadModule commands tell Apache to load various external modules. Don’t touch these unless you know what you are doing, If you remember when we first installed WAMP in the first tutorial, we added a LoadModule line for PHP (LoadModule php4_module php4apache2.dll). That’s because PHP is an external module that Apache needs to load for PHP scripts to work. Move the PHP LoadModule line from the end of the file, where you put it on install, to the end of the LoadModule block.

Line: ServerAdmin

Make sure the email address you wish to be contacted on is here. Should any error page crop up this will allow people to contact you.. This is not really a major issue on a development server, however, should anything go wrong this would let people know who the server belongs to.

Line: ServerName :

localhost:80 will do for this one; for similar reasons to ServerAdmin.

Line: DocumentRoot

This tells Apache where your web documents are stored. You can leave this as is, or change it to something you prefer (c:webdocs might be quicker to browse to than C:/Program Files/Apache Group/Apache2/htdocs). Whatever you do, make sure the directory exists and that you copy all your files to it.

Line: AddType

Back when you installed PHP and added the LoadModule line you should have also added an AddType (AddType application/x-httpd-php .php) line. AddType tells Apache which extensions to associate with which types of documents. Move the PHP AddType line from the bottom of the file to the bottom of the AddType block. If you wish you could change the PHP AddType line to something like (AddType application/x-httpd-php .php .htm). This will associate .htm file types with PHP, so you can include some php scripts in htm files.

We will be adding another AddType line (AddType application/x-httpd-php-source .phps). This line will make the extension .phps a PHP Source file, which will display the PHP code with special coloured formatting (once we turn script highlighting on in PHP). You will probably find this quite useful for debugging.

Line: ErrorDocument

These allow you to create your own documents to handle errors. For instance, if a page is missing you usually get an ugly page with a message similar to ‘404 Not Found’. Well, you can make your own error pages. This will be more fully covered in a future tutorial; however, for the moment uncomment the line (’# ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var’) by removing the ‘#’ and change the .html.var extension to .html. In your document folder create a new directory called ‘error’ then create an html page called HTTP_NOT_FOUND. This page should contain a message telling the user that the page they clicked on could not be found. You should also include a link to your main page. Now, after Apache is restarted, whenever you go to a page that doesn’t exist (http://localhost/bad/page) you will get your own pretty error page instead of the standard ugly one.

That’s about all you have to worry about for Apache. As I said before, I recommend that you change one setting at a time, test the configuration (Start > All Programs > Apache > Configure > Test Config), and, if the black screen disappears, fine, if it stays, take note of any errors and correct whatever you may have done wrong. Remember that no changes will take effect until Apache has been restarted (Start > All Programs

« 

Technorati Tags: , ,




Installing PHP under Windows: Further Configuration of WAMP

Friday 17 March 2006 @ 8:18 am

PHPIn his last article, Matthew showed us how to successfully install and configure WAMP (Windows, Apache, MySQL and PHP) to setup a development environment.  In this next piece, learn how to make use of the Apache and PHP configuration files to further enhance your server needs.

In the previous tutorial, your WAMP system on your home PC is best for use as a development server only. You may be able to host a personal home page or hobby page, but of course this would only be available when your computer is on and online.  Bearing in mind our decision to only use it as a development server we will have a specialised configuration.

In an attempt to make code developed on our server portable to the widest possible range of configurations, for other peoples’ servers, we will deliberately have a strict configuration, with many options turned off, this will force us to use ‘better’ programming techniques thus allowing anyone with Apache and PHP to run our code.

First we are going to configure Apache, I will attempt to justify my choices for any configuration changes that I make, as well as briefly explain other possible options.  This will allow you to choose your own options should your opinion differ from mine

 

« 

Technorati Tags: , ,




Google pagerank inspector

Sunday 12 February 2006 @ 1:47 am

Check your Website`s pagerank and the pagerank of the pages linked to it :)
~ HERE ~

« 

Technorati Tags:




Create image with PHP / GD library, And Adding Fonts

Sunday 12 February 2006 @ 1:45 am

GD Library is one of the cool features started from PHP 3.0 , It`s helps create image on the fly , It just needs PHP and GD library Installed on the server.
~ It`s Just Creation of images from PHP ~ (more…)

« 

Technorati Tags: