Archive for PHP Web Hosting

How to create PHP-GTK GTK+ menus / menu items?

PHP Programming Language Logo ImagePHP-GTK Logo

In respect to our forum post on how to install PHP-GTK on Ubuntu / Linux, we will have a series of howtos on our blog with respect to PHP-GTK – which is a PHP language binding to the GTK+ widget toolkit. With this in mind, you can create pretty robust desktop applications using PHP-GTK. In this article, we’ll show you how to create menus using PHP-GTK – and because the documentation is somewhat quite bear we thought we’d make an article on various aspects of PHP-GTK you may struggle to understand at first.

How well supported is PHP-GTK?

In comparison to PyGTK (a Python GTK+ language binding) and other language bindings you can use, PHP-GTK is not as widely supported as one would hope so if you are considering using PHP-GTK for most robust application development, you’ll unfortunately need to consider using a different language binding, such as Python. Many Linux distributions come bundled with all the packages you need to start developing and running PyGTK applications. However, with PHP-GTK, you need to install the dependencies and then compile and install PHP-GTK. If your primary target market is those that will understand how to execute commands via the Terminal and wouldn’t mind doing so, sure, PHP-GTK is a good option – and especially because on Windows, there are pre-compiled binaries available. All you need to do with the pre-compiled binary is execute your PHP-GTK script against the PHP interpreter executable. On Mac OS X, installation isn’t as easy – it’s essentially as cumbersome as getting PHP-GTK installed on Linux distributions.

How do I install PHP-GTK?

For Linux distributions, a link at the top of this article is to a forum post we have on our Web Hosting Forum with a detailed howto on getting PHP-GTK installed on Linux distributions such as Ubuntu. The primary issue at hand here is that you need to install quite a few packages (which are referred to as “dependencies” – because PHP-GTK depend on these packages prior to you being able to compile and install PHP-GTK). Once these dependencies are installed, all you need to install after that is “pecl-cairo” (the Cairo Extension) and then compile and install PHP-GTK. However, on Ubuntu, you may also need to do one more step which is relating to libtool.m4. All with easy to follow instructions in the thread itself.

PHP-GTK code.

So let’s take a look at the code – the code is commented to explain each part.

public function addMenu()
{
/* create the menu */
// the “File” and “Help” main menus
$file = new GtkMenuItem(“File”);
$help = new GtkMenuItem(“Help”);

// create the menubar
// we append the File, Help to the MenuBar
$menubar = new GtkMenuBar();
$menubar->append($file);
$menubar->append($help);

// append the menu options
// this is for the actual menu options

// this is for the “File” menu
$menu = new GtkMenu();

// this is for the “Help” menu
$menu2 = new GtkMenu();

$open = new GtkMenuItem(“Open”);
$save = new GtkMenuItem(“Save As…”);
$quit = new GtkMenuItem(“Quit”);
$about = new GtkMenuItem(“About”);

// connect the signals

$quit->connect_simple(‘activate’,array($this,’menuOptionClicked’),”quit”);
$open->connect_simple(‘activate’,array($this,’menuOptionClicked’),”open”);
$save->connect_simple(‘activate’,array($this,’menuOptionClicked’),”save”);

// we append the menu items to the MenuBar
$menu->append($open);
$menu->append($this->menuSaveItem);
$menu->append($quit);

$menu2->append($about);

// we set the MenuBar as the submenu for the MenuItem “File” and likewise for “Help”
$file->set_submenu($menu);
$help->set_submenu($menu2);

// we the pack the $menubar the MenuBar (which holds File and Help, to the init_vbox)
$this->init_vbox->pack_start($menubar,FALSE,FALSE);
}

You can then execute this method where necessary. For example, via the constructor method. Such as:

public function __construct()
{
$this->addMenu(); // execute the addMenu() method
}

And that’s it! It’s not as simple as it could be, but once you understand how it works – it’s easy to do again.

PHP development team announces immediate availability of PHP 5.4.6 and 5.3.16

PHP Programming Language Logo Image

The PHP development team announced yesterday the immediate availability of PHP 5.4.6 and PHP 5.3.16 which fixes over 20 bugs. All users are encouraged to upgrade to the latest stable versions of PHP 5.4.x and PHP 5.3.x. Our VPS Hosting and Dedicated Hosting customers can upgrade their PHP install by using EasyApache within Web Host Manager (WHM).

PHP is one of the most popular server-side scripting languages used on the Web. It was created in 1995 by Rasmus Lerdorf, originally as a small set of Perl scripts he referred to as “Personal Home Page Tools”. By the time PHP 3 came along, it had many of the features that we use in PHP every day. In PHP 5 saw the introduction of better support for object-oriented programming (even though there was quite complete object-oriented support in PHP 4 – although in PHP 5 came the introduction of being able to change the visibility of methods and class variables. In PHP 5 also saw the introduction of the object-oriented lightweight and easy-to-use PHP Data Objects – an object-oriented interface for connecting to and performing database-related functions – was also introduced. PHP Data Objects is a good alternative to using standard procedural functions for connecting to databases, performing queries and fetching results.

There has been many controversial features in PHP that has later been deprecated and removed. One of which primarily being Magic Quotes which enabled the automatic backslashes of certain characters which assisted users in escaping input in a SQL query to prevent SQL injections occurring. However, this was widely criticised for helping inexperienced developers write insecure code because they do not otherwise need to manually sanitise input prior to input being part of an SQL query for execution. In PHP 5.4, Magic Quotes was completely removed.

New features in PHP 5.4

In PHP 5.4, some new features were introducing. As well as Magic Quotes being removed in PHP 5.4, the release also came with some good new features including:

  • The short open tag (<?=) is now always available regardless of the short_open_tag option in the php.ini configuration file.
  • From PHP 5.4 onwards, you can now access methods and class variables directly after instantiation of the class. Such as (new Class)->method().
  • Short array syntax. For example: $array = ["Blog","Forums","Knowledgebase"] and $array = ["name_1" => "Blog, "name_2" => "Forums", "name_3" => "Knowledgebase"].
  • The $this reserved variable can now be used in anonymous functions (also referred to as closures).

php web hosting

PHP Web Hosting

PHP is a popular open-source programming language used by many websites designers and developers to build dynamic web applications for users to interact with. In most cases, dynamic PHP web hosting applications will be using a MySQL database backend so that all the necessary data can be held in one central store. Since PHP is an open source and free language, it has been developed to work on both Windows and Linux, meaning that you should be able to run PHP scripts on Windows Hosting and Linux hosting.The MySQL database server can also be run on Linux and Windows, meaning that application developed using both PHP and MySQL will run on Windows Hosting and Linux hosting.
Because it is free, more or less every web host is able to provide you with support for the PHP scripting language on their hosting servers, regardless of whether they are running Linux Server or Microsoft Windows Server. The same can also be said for the MySQL database server. Normally, hosts who can provide PHP and MySQL web hosting normally display the logos of both products on their website so that it stands out for first time visitors. At current, the logos display should be the ones shown below.

Although PHP will run easily on Microsoft Windows hosting, it is recommended that you run any PHP and MySQL applications that you have developed within a Linux hosting environment. The main reason for this is that PHP has proved to be more reliable and faster when used on Linux servers, as opposed to Windows hosting servers. The best type of web hosting package for you if you are a developer who needs to host PHP and MySQL applications in a live environment would be a Linux cPanel web hosting account, since you will be provided with advance PHP and MySQL management features. Many popular web hosts, such as eUKhost provide these types of packages, and in some cases can even tailor them to your requirements.
cPanel, one of best known Linux hosting control panels, is able to provide you with accurate and necessary information in relation to the versions of PHP and MySQL installed on your server, which may be useful when you are developing applications for hosting.

Since PHP is a free language, there is no official support medium; the same also applies to the Community Edition of the MySQL Server, although there is an enterprise edition available. However, many PHP developers do share their knowledge with others who are looking to learn the language through online forums; this means that you should always be able to find an answer to any PHP related question or problem.
So, if you are a beginner with PHP, you can start out with a basic cPanel Linux hosting package from eUKhost which you can then use to help you develop your knowledge of the PHP scripting language along with the MySQL database server. You can then use the available mediums of support to help answer any questions or problems you might face whilst learning the language.

What is PHP?

PHP Programming Language Logo ImageQuestion Mark Image

What is PHP?

You hear all those articles about how good PHP is, and how it’s the best Web development kit you’ll ever need, which of course is true – but you may not even know what it is about and how it is used.

For starters, let’s just compare what you can do with HTML and PHP – with HTML, you can make static Web pages that are not interactive to the visitor and with PHP, you can make dynamic Web pages that are interactive to the visitor. Remember, you’ll always need HTML in your PHP development, as HTML, as we know, structures (and possibly styles, in some cases) our Web pages. Luckily enough PHP is an HTML embedded scripting language, so, unlike other scripting languages, HTML can be embedded inside PHP files (or, in other terms, the PHP code).

I must stress – PHP is not anything to do with HTML, and isn’t used to build Web pages like HTML can do, however it is used to build dynamic Web pages. Okay, let’s make an example:

  • You build the online form using HTML
  • You set it to your e-mail address
  • You save the file

Okay, fair enough, what’s the big deal then? This isn’t dynamic – as when a visitor visits the Web page, upon clicking the button to submit the form, their favourite e-mail program will open up with the e-mail contents, and they’ll have to manually submit the e-mail themselves.

However, with PHP, that’s a little different. Using the HTML form as normal, we submit the form data to a different page on your Website and some PHP pre-defined variables as we call them POST or GET hold the form data and then sends the contents of those pre-defined variables to your e-mail inbox, without the visitor having to do a thing! Now, that is a dynamic Web page, as it’s interactive to the visitor.

Now, if you think about it – if PHP can do that, it can do a lot of other things too! Well, you’re absolutely right! PHP could display the form data they submitted on the second page (where the form data is e-mailed to you), by simply (as us programmers call it) “echoing” the contents of the variables to the Web page, using the echo function.

What are functions?
The best thing about PHP is it is quicker to setup a dynamic Web page than other scripting languages. Why, you ask? Simply because of the wide use of functions PHP have. Unlike other scripting languages, PHP has functions for almost anything you can think of, including to prevent exploitations in your code, to check string lengths (for submitted forms, for instance), to check particular variables values are integers, and so much more. Whenever you want to look up a function in PHP, usually just typing it in on Google will get you the results you need, but go to the official PHP Website (which is www.php.net) where you’ll find tutorials on every single function. You can also find the PHP manual there (which is incredibly step by step and easy to understand).

Hmm, I’m not really sure, I mean, all this “fish talk” seems a bit too complicated!
If you haven’t noticed already, PHP is the most widely supported language on the Web, and you’ll find hundreds, upon thousands of resources over the Internet as well as community forums devoted to PHP, which I am sure would be able to help you on your PHP footpath. There are also PHP mailing lists at PHP.net, which you can signup to, absolutely free, for whenever you need help. And, not to mention, eUKhost.com community forums, we are here to help – if you have any PHP specific problems or questions, we have quite a few PHP competent members on our forum which would be happy to help you, join in at www.eukhost.com/forums

I hope you enjoyed this article and found out why PHP is such a good language, and what it is about. There are so many resources over the Web related to PHP you’ll never become lost; Google.com is the only thing you’ll need to find the resources you need ;) . Good luck!

http://blog.eukhost.com/webhosting/howto-remove-grub-loader-and-restore-windows-7-and-vista-bootloader/

PHP vs. ASP.NET

PHP and ASP.NET are the two main scripting languages used by web developers. PHP is a multi-platform open-source language whilst ASP.NET is a single platform language built and owned by Microsoft. Both of these languages are packed full of features and add-ons for both are available so that you are able to extend their framework to build feature rich applications. Although PHP is open source, it has a large active community which is there to support users of the language; ASP.NET is a product of Microsoft meaning that there is a large amount of online documentation and other community forums where you can get support.

PHP

PHP is a language which has been around since 1984 and powers many of the world’s websites. It is free and is known as ‘open source’ software meaning that its source code is available for download, at no cost. It widely used in conjunction with the MySQL database engine, but can be used with others such as Oracle and SQLite. PHP is generally easier to code in than ASP.NET, since it has more functions built in than its rival; however, ASP.NET has built-in AJAX functions which is something that PHP lacks. Since PHP is open source, there is a number of applications that are available for free based on it, most of these applications are commonly used and are very powerful; also, there is a greater number of community forums and blogs where you are able to find information regarding PHP since it is open source.

PHP is a dynamic language since there are several different types of database that you are able to connect to, including: MySQL, Oracle, PostgreSQL and in some cases, Microsoft SQL Server. You are also able to edit the source of the language if you wish to speed it up or install custom modifications so that it is able to run as per your requirements; again, this is because it is open source – although ASP.NET is a free language, it isn’t open source meaning that you are unable to edit its source.

ASP.NET 

ASP.NET is a language based on classic ASP – both languages are owned and were created by Microsoft. Although it is a free language, it isn’t open source meaning that you are unable to view or edit the source code of it. Also, it is very limited in what database types you can use with it – Microsoft only invented it to work with Microsoft Access and Microsoft SQL Server databases, although developers can use it with MySQL databases with the help of third party components. Classic ASP, ASP.NET’s forefather, was created back in the mid-1990s and is the base which ASP.NET has been built on. One thing which annoys many ASP.NET developers is the fact that Microsoft is forever releasing updates to the system, and in its course, changing things along the way meaning that in some cases, developers have to keep on learning the changes as well as the new components and functions which are being added.

Like this post ?

Share on your Social Networking Profile ( Facebook, Twitter & Google+ ) and get a flat 10% Recurring discount on our VPS Hosting and Dedicated Servers.

Email us the shared link at : sales@eukhost.com or speak to our live chat operator now, by clicking on the “Live Chat” Scroller on the left-hand side of this page and we will provide you with the discount Coupon right away!


« Previous entries Next Page » Next Page »