PHP Related Questions (29 Articles)

Does Siteground support PHP HTTP Authorization?

Siteground supports the PHP HTTP Authorization and in order to enable it you need to add the following lines to the .htaccess file located in the web site's home folder: RewriteEngine on RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1] You need help with the technicalities of your website? We have your back! Sign up for […]

Is PHP Safe Mode turned Off on SiteGround’s servers

PHP Safe Mode is by default turned off for all PHP versions available on SiteGround servers. Note also that this feature has been deprecated as of PHP 5.3.0. PHP developers highly encourage people to not rely on this feature any more. You need help with the technicalities of your website? We have your back! Sign […]

How to enable zlib compression manually for PHP scripts

PHP Zlib module allows you to transparently read and write gzip compressed files. Thus it is used for serving faster content to the end users by compressing the data stream. Some applications like Pligg require zlib compression enabled by default in the PHP engine. For this purpose you can easily enable it by placing the […]

What is SourceGuardian and how to use it?

SourceGuardian is commercial software which allows you to securely encode, compile and encrypt php scripts. In this way you will protect your source code from viewing and editing. You can lock your files based on the server IP where they will be opened, based on the domain name, the MAC address or a defined time […]

How to install Smarty Template Engine

Follow the steps below to install Smarty Template Engine on your hosting account: Download the latest version from the official website. Extract the package on your computer. Upload the libs folder to your hosting account (for example in the public_html folder) Create a php.ini file and add the following line to it: include_path = /home/username/public_html/libs/ […]

My script requires ionCube loaders Do you have ionCube installed?

The ionCube loaders PHP extension is installed on all of our shared hosting servers by default. If you want to check the ionCube loaders version, please create a PHP script on your account with the following content: <?php phpinfo(); ?> Then access the file via your browser and it will show you the entire configuration […]

How to generate PDF files with PHP?

FPDF is a PHP class that allows you to generate PDF files without using the PDFlib library. FPDF is free and can be downloaded from the official website’s download section. The download package contains all necessary files, along with some tutorials on how to use it. A basic example of using FPDF is with the […]

How to modify PHP settings without using php.ini files

When PHP is running as a CGI module,  PHP settings cannot be modified through an .htaccess file. If you would like to modify a PHP setting, you would have to use php.ini files. Unfortunately, php.ini files work only on a per-folder basis. In other words, if you would like to apply custom PHP settings to […]

How to enable error reporting in a PHP script?

There are two ways to enable error reporting in your PHP scripts.   1. You can add the following function in the .php file for which you would like the error reporting enabled:   error_reporting(E_ALL);   2. You can add the following option in the php.ini file for your web site:   error_reporting = E_ALL […]

How to change the timezone for a single PHP file?

You can set a specific timezone for a PHP script using the following function which should be added to the PHP file: putenv("TZ=US/Central"); This is just an example. The full list of supported timezones is available here. You should simply replace "US/Central" with the desired timezone. If you wish to change the PHP timezone on […]

How to check if a PHP function is available on the server?

You can check whether a PHP function is enabled by using the function_exists function in a simple PHP script. For example, if you wish to check whether the fsockopen function is enabled, you can put the following code in a php file:

Then you should open the file in a browser and see the […]

How to check which PHP version is running on my account?

Thanks to SiteGround's server setup, it is possible to run different PHP versions for different folders in your account. More information on how to do this can be found in this article. In order to check exactly which PHP version is used for a certain folder, you should create a simple php file (for example […]

How to include PHP code in .htm/.html pages?

In order to include and execute PHP code in .htm/.html pages, you should set PHP as the default handler for these pages. You can easily do this by adding the following line to your .htaccess file: AddHandler application/x-httpd-php52 .php .htm .html Of course, you should make sure that your PHP code is correct and is […]

How to change the date.timezone value in PHP

If your PHP scripts do not show the correct time, the reason is that most probably your hosting server is in a different timezone. This can be easily resolved by changing a setting in PHP called date.timezone. Depending on your location you can set a specific date.timezone value in PHP using the following option which […]

Does SiteGround support PHP 4?

SiteGround supports PHP 4 on all shared servers. In order to change the PHP version for your account, follow these steps. Go to cPanel, File Manager Choose "Web Root (public_html/www)" Create a new file (or open the existing one for editing) called .htaccess Add the following line: AddHandler application/x-httpd-php4 .php .php5 .php4 .php3 You need […]

PHP Error: Cannot modify header information

This is a common PHP error which is usually caused by: - White spaces before or after the PHP start "<?php" or end "?>" tags; - Various problems with the header() statement. Check carefully the code before and at the line of this statement. This error might be hard to troubleshoot in cases where different […]

How to include remote code in Php 5.2

By default remote code inclusion is not allowed in Php 5.2. This is an important security improvement over the previous versions. However, some scripts may require to include remote code in order to work properly. For this purpose create a php.ini file and specify the following line: allow_url_include=on This will change the default Php directive […]

How to increase PHP Memory?

Some applications advise that the PHP Memory be at least 128 MB. Unfortunately, you cannot have such a high value on the shared server because of possible server overloads due to excessive memory usage. However note that this is only a recommendation and you will not experience problems in most cases. If you find out […]

How to submit web forms with PHP

How to create secured web forms using PHP In order to create web forms using PHP you can use the integrated mail() function. It is highly recommended to implement antispam functions in your scripts as well. That is needed to ensure that no undesired messages will be relayed through your account. The following script is […]

Is PEAR included in your Php installations

Yes, the standard PEAR packages are included in all Php installations. If your application requires a certain PEAR package which is not included please check this article: You need help with the technicalities of your website? We have your back! Sign up for our hosting and let us support you along the way! Check […]