Archive for PHP Hosting

Do you have PEAR (PHP Extension and Application Repository) installed on your shared servers?

PHP Programming Language Logo

Yes we do. All of our shared web hosting and reseller web hosting servers have the PEAR library installed.

What is the PEAR library?
PEAR (PHP Extension and Application Repository) is an object-oriented PHP library with separate classes for a variety of functions including mail, database interactivity, date and time, encryption, images, HTTP, HTML and much more. For example, the HTML_Form class is used to assist in the automatic creation of HTML forms. Even more useful classes include the File class, used for reading from and writing to files on the file system from which the PHP application is being executed from. An even more interesting class in the library is the File_SearchReplace class, which automates find and replace operations for files where you may want to find certain strings and replace them in a specific file.

The PEAR library is incredibly robust and useful. You do not need to use the PEAR library in order to connect to and interact with databases, as there are built-in functions and extensions in the PHP language itself, including the object-oriented PHP Data Objects Extension (which is also very easy to use).

Read more about PHP Data Objects: Accessing and Using Databases using PHP Data Objects

What is a postback with regards to websites/web development/programming?

A postback is the term to refer to data that has been POSted back by the client to the server. For example when you submit data on an HTML form via your web browser (which is the client here), when you submit that form, a postback to the server occurs. Effectively, the web browser, with its HTTP request for the specified file, will also have the postback data. If you have a PHP application, by using the $_POST and $_GET superglobal variables (or $_REQUEST to refer to $_POST, $_GET and $_COOKIE in one), you can retrieve the postback data within your PHP applications.

A primary example of a postback is a login or registration form – the postback data will consist of the username and password, and any other information fields you require on either forms.

PHP code is not working on my website; displays the code

By default (and on all of our shared servers), it is important to have your PHP code in .php files, because .php files are set up on most servers to be dealt with by the PHP interpreter (the software on every server to be able to use the PHP programming language). If you add such code to .html files, it will not actually do anything, because those files are not set to be parsed (rendered / executed) by the PHP interpreter.

This is quite basic for many people, but beginners to PHP or web development may not realise this.

Steps to Copy a MySQL table with phpMyAdmin Explained

The article would help you with a step-by-step procedure about how to copy a table with phpMyAdmin located within the cPanel control panel.

Step 1 : Log into cPanel

Step 2 : Go to phpMyAdmin and choose the database and the table that you intend to copy

Step 3 : Go to the option titled “Operations” listed amongst the other tabs

Step 4 : Locate the box titled “Copy table to (database,table):

Step 5 : There are two options you may choose from ie. either create a copy of the table to the current database (usually gets selected by default) OR copy the table to a different database

Step 6 : Choose the database name from the drop-box and the name of the table to copy the structure and / or data into.

You are required to choose between the following options before proceeding any further :

  • Structure only – Selecting this option would only create a copy of the table and its name. You must note that the data wouldn’t be copied in this case.
  • Structure and data – Choosing this option would allow you to copy the table along-with its name, but would also copy the data it contains to the destination you choose further in the process ie. INSERT INTO >> SELECT * FROM …
  • Data only – Clicking the radio button would only copy the data to the destination.

Furthermore, you are offered the option to choose whether you wish to drop the table that you are copying to before creating the table and copying the data. This runs a DROP TABLE IF EXISTS query for the copy of the table, not the original. You would not notice any change if you’ve chosen data only copy.

Then you’d have the option to choose to copy the auto increment value. This isn’t a default function, and you’d need to check it manually. The auto increment value will end up being whatever it would be after the INSERT INTO query is done. Checking the box would activate the CREATE TABLE syntax which would then include the auto increment value from the original table.

Lastly, you can see the option termed “Switch to copied table ”, as the title suggests you’d be switched over to the copied table once the queries are completed. If you leave it unchecked, the resulting page will still be looking at the original table; if checked it will change to the copied database (if applicable) and table.

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!

PHP code to set expiration for index page

PHP language is an open source web scripting language which is included within HTML tags to implement any logic. And Due to popularity of PHP language many web hosting providers have started deploying PHP hosting servers which are actually called cPanel hosting servers to host a PHP website with MySQL to support database of a website. But because of some reason if you want to make any changes in your site so you can set the expiration to your site  means after some date or year your site shows custom error on the page then you can add following code in index page below the “<?php” code and set the date as per your request.

$exp_date = “2012-04-31″;
$todays_date = date(“Y-m-d”);
$today = strtotime($todays_date);
$expiration_date = strtotime($exp_date);
if ($expiration_date <= $today)
{
echo ‘<!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”>
<html>
<head>
<title>Expired…</title>
</head>
<body>
<h1>What you search</h1>
<p>Now Site is Expired </p>
<hr>
<address>I have set the expiration to my site ,we need to increase expiration date in index page</address>
</body>
</html>
exit;
}

This is really simple which yu have to include in your index page to get the thing done at correct date but you need a quality web host to host your mission critical web site and Bodhost UK web hosting service provider is best from last decade for deploying quality server with up time guarantee and online security.

Script to create hosting packages on cPanel hosting server

Web hosting has different platforms and from these platforms one can host his business online or can earn through it. Reseller hosting is a kind of hosting type which allows an individual to resell hosting packages under his own price tag and brand name to run a web hosting company under his own name. But sometimes if you want to migrate more accounts from one server to another server then you need to create packages for each accounts and you can easily create packages by using this script.

1) First you need to create one Migarting-Accounts.txt file and add the the user name , which you want to create packages.

2) Create Migration directory for to move all the cPmove files from /home directory to Migration directory.

then use following command to create cpmove packages and moved to “Migration” directory.
for i in `cat /home/Migarting-Accounts.txt`;do /scripts/pkgacct $i; mv /home/cpmove-$i.tar.gz /home/Migration/;done

or Use this script for migrating Reseller and/or Bulk accounts between cPanel hosting servers::

For Reseller::
cat /etc/trueuserowners | grep username | awk ‘{print “/scripts/pkgacct “$1}’

OR

1. cat /etc/trueuserowners | awk ‘{print $1}’ > 1.txt
then remove the sign “:” from 1.txt

for i in `cat 1.txt`;do /scripts/pkgacct $i; mv /home/cpmove-$i.tar.gz /home/Migration/;done

Then move the “Migration” folder and 1.txt file to remote server and by using following command restore all the accounts.
for i in `cat 1.txt`;do /scripts/restorepkg $i;done

To migrate you server you need a quality technical support from your hosting provider and Bodhost UK web hosting provider is deploying quality hosting services from last decade with  reliability, quality hardware and tech savvy support people to solve any problem.

Install Suhosin PHP Protection Security Patc on Linuxh

A number of open source application are preferred widely across the web, hence its security becomes a vital concern to the developers, providers and more importantly the users. Inorder to protect the applications developed in PHP, Suhosin is strongly recommended. The Suhosin patch offers great help with protecting the PHP based application from being completely exploited. The patch is considered to offer an advanced protection system for PHP installations. The main idea behind designing Suhosin was, to offer protection for servers against various attacks and other known issues in PHP.

How do I install Suhosin under different Linux Distributions ? (RHEL / CentOS / Fedora)

Step 1 : Download latest version of Suhosin, enter the following command for that purpose

# cd /opt
# wget http://download.suhosin.org/suhosin-0.9.32.1.tgz

NOTE : You must ensure that php-devel is installed:

# yum install php-devel

Step 2 : Then Compile Suhosin under PHP and RHEL / CentOS Linux using the below commands

# cd suhosin-0.9.32.1
# phpize
#./configure
# make
# make install

Step 3 : The Configure Suhosin onto the server, using the below command a configuration file of Suhosin would be created

# echo ‘extension=suhosin.so’ > /etc/php.d/suhosin.ini

Step  4 : Using the below command you must not restart the server

# service httpd restart

NOTE : Incase you have lighttpd activated on the server, you must use the below command to restart it

# service lighttpd restart

Step 5 : Now you must recheck whether Suhosin has been installed on the server. Using the below command you may do so

$ php -v

NOTE : You may run the following command to check for more details

<?php
phpinfo();
?>

Web_Hosting_UK

How To Create a Phpinfo Page ?

The phpinfo.php is a kind of file that allows you to watch the information about your dedicated server. The phpinfo file doesn’t consists of the MySQL information, but it holds all the version information about the PHP, Apache/IIS, GD and many other things on your server. Most of the times you will see many important settings details in the phpinfo file, which might be causing some issues with the installations.

There are many other things that can be seen using the phpinfo file, such as: current version, path to php.ini file, operating system version, hostname, timezone of your system, server API, path to local php.ini file, configuration options such as log_errors, register_globals, post_max_size, memory_limit, safe_mode, etc… In addition to this, the phpinfo file will show you the active modules which are loaded with PHP and its existing configuration settings.

The phpinfo.php file is a simple php script and could be created and stored anywhere on your dedicated server.

Step 1: In order to create a phpinfo file, simply open a plain text file and add the following single line to it and save the file as phpinfo.php .

<? phpinfo(); ?>

Step 2: That’s all you need, now simply upload the created file to your web server. You should upload the file to the exact destination you want to test. Usually, it will be your public_html folder, although its upto you. You can even upload the file to any subdirectory on your server. Use your favourite FTP client to upload the file.

Step 3: In order to visit the page in your browser, simply type the destination url where you have uploaded the file. Here in this tutorial we have added the file in the public_html directory so, the url would be as shown below:

http://www.yourdomain.com/phpinfo.php

Make sure you replace your sitename with “yourdomain”.

That’s it ! Now you can view all the information about PHP for your dedicated server for that specific directory.

Installing Alternative PHP Cache (APC) on Server

Installing APC on your Virtual Private Server

The APC-Alternative PHP Cache is a free, open, and robust framework that is responsible for caching and optimization of PHP.

Steps to Install APC on your web server

Step i – You must be logged in as root to proceed with installing APC on your server

Step ii – You must then download the APC

wget http://pecl.php.net/package/APC

eg : wget http://pecl.php.net/get/APC-3.0.15.tgz

Step iii – Having done that, you are then required to extract it over your Web Hosting UK server:

tar -xzf APC-3.0.15.tgz

cd APC*

Step iv – Look for the PHP location by running the below command :

which php

You must remember the location displayed in the result.

Step v – Now you need to proceed with creating the configuration files using the below command :

phpize

Step vi – Now the APC need to be compiled over the server :

./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/local/bin/php-config
make
make install

Note : You must install the APC in the php.ini file

Step vii – Run the below command to find the php.ini over the server :

php -i | grep php.ini

Step viii – Amend php.ini by adding APC extension, as stated below :

vi /usr/local/Zend/etc/php.ini

Step ix – Add the following to the php.ini file :

apc.shm_segments=1
apc.optimization=0
apc.shm_size=128
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1

Step x – Finally, you must restart Apache using the below command :

service httpd restart

If you need any assistance with that, please contact our technical support department via. 24×7 Live Chat or raise a ticket via. our helpdesk


How to increase Your WordPress and PHP Memory Limit ?

cPanel Web Hosting

WordPress is a great blogging tool or a content publishing platform that comes with a rich set of features. Using the in-built appealing features you can create a professional looking site or blog just within few steps.

WordPress is a script that is included in the Softaculous or Fantastico software which is offered for free with any cPanel Web Hosting package. Usually, wordpress has a default memory limit of 32MB, which is not sufficient when you increase the number of plugin or when your blog traffic increases tremendously.

What if your wordpress blog stops functioning and show an error ?

Fatal error: Allowed memory size of 33554432 bytes exhausted …

In such case, most of the times people either open a ticket at the HelpDesk and wait for the response from their uk web hosting provider. Some people try to make changes in the .Htaccess file and corrupts whole wordpress blog. Before doing any changes to the wordpress files the user should always backup the wordpress data.

The above issue can be solved by navigating to the wp-config.php file usually which is located at the wordpress installed folder. Edit the file using SSH or the File Manager and add the following line to the wp-config.php file.UK Cloud Hosting

define(‘WP_MEMORY_LIMIT’, ’64M’);

The above memory limit can be set up to 32MB, 40MB, 64MB or 128MB.

If you are on a cPanel shared hosting plan, you will need to ask your web hosting provider to increase the memory limit. If your wordpress is on a self-hosted plan, then you can increase the memory as long as you want, but should not exceed the RAM allocated to your dedicated server.

Since, the WordPress is a collection of PHP based files, you will need to increase the memory limit of PHP as well. If your WordPress is self-hosted, but have multiple blogs installed, you will required to assign enough memory in order to handle all the installations.

On the cpanel servers, you will find the PHP file located at the following location:

/etc/php.ini

Simply, find the below line in the file:

memory_limit =

Allocate the memory limit according to your requirements. Since, we have allocated 64MB of memory in the above example, in PHP file we will allocate the same amount of memory to PHP.

memory_limit = 64M

Accordingly, if you are having 2 wordpress blogs consuming 64MB memory each, you may set the PHP memory limit to 128MB as shown below:

memory_limit = 128M

Once you are done with the above steps, simply refreshing your wordpress blog will solve the memory limit error.

Cloud Hosting

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 »
Content Call us at 0800-862-0380