PHP

Is allow_url_fopen enabled on your servers?

PHP function allow_url_fopen is enabled on all of our Shared Hosting packages.

Do you support GCC compiler?

GCC compilers are not supported on Hostinger.com our servers. You can still install it on our VPS packages: https://www.hostinger.com/vps-hosting

How to turn off PHP error reporting?

To turn off PHP error reporting you can use the following snippet in your PHP script: error_reporting(0); Just remember to call this before any other PHP directive. Alternatively, you can add this line to your .htaccess file (it is located in your public_html folder) to suppress any php error messages: php_flag display_errors off You can also turn off php error messages by going Member area -> Hosting control panel -> PHP configuration, choose Disabled for Display Errors.

PHP Fatal error: Cannot redeclare

If you see error message 'PHP Fatal error: Cannot redeclare function' or similar error message in your script, it means there is a problem with your script code (it tries to declare the same function multiple times). This error says that your function is already defined. This could mean: * you have the same function defined in two files * you have the same function defined in two places in the same file * the file in which your function is defined is included two times (so, it seems t...

I get 'unexpected T_STRING' error

You may get this error because all .html files are parsed as PHP here. So, if your .html file contains "<?" or "?>" tags/text (which shows for file parser that PHP code started), you get this error. This can happen with XML files if they are not using correct content type. If order to fix this error you need to remove "<?" and "?>" symbols or entire lines with these symbols from your HTML page source.

Parse error: syntax error, unexpected T_PRIVATE

If you get error message 'unexpected T_PRIVATE' or similar error in your script, make sure your script does not use "reserved" variables. For example, $private is "reserved" variable in PHP5, so rename $private to something else and everything should work fine. To learn more see this link: http://www.google.com/search?q=unexpected+T_PRIVATE

I get 'Invalid argument supplied' message

If you see error message 'invalid argument supplied' or similar error message in your script, it means there is a problem with your script coding (it's not related to hosting servers). You can find a solution here: http://www.google.com/search?q=PHP+Invalid+argument+supplied

How to parse PHP in HTML files?

If you want to make all of your website's .html pages to run as .php files instead (parsing PHP in HTML files), all you need to do is add the following line to your .htaccess file: AddHandler application/x-httpd-lsphp .htm .html IMPORTANT: Make sure to make backups of your original .htaccess file, as making changes to this file can disrupt access to your website.

How can I modify the PHP timezone setting for my website?

Your server's Global time configuration cannot be changed, but you can use the PHP function date_default_timezone_set to set the timezone for your website. Here's an example code that sets and checks the currently set timezone: <?php date_default_timezone_set("Asia/Bangkok"); echo date_default_timezone_get(); ?> A list of available PHP timezones can be found here: http://www.php.net/manual/en/timezones.php

How can I change the php.ini file?

Access to the php.ini file is not allowed for Shared Hosting customers here. However, most PHP values and settings can be used by using the .htaccess file with the help of php_flag. You can learn more about .htaccess file here (https://www.hostinger.com/tutorials/?s=htaccess)

Can I hide errors and warnings that are displayed on my website?

PHP Errors and warnings can be turned off through your Hosting Accounts Control Panel. To disable/enable your account's PHP errors, access your Control Panel and locate the PHP Configuration menu. You can also just type "PHP" into your Search Bar at the top of your Control Panel page. Access the PHP Configuration menu, search for the Display Errors field and choose to enable/disable it. Once that's done, hit Save at the bottom of the menu. Notes: * It's highly recommended to turn t...

Can I enable Zlib compression?

You can quickly enable/disable "Zlib Compression" for your Hosting Account through your Control Panel. To enable/disable "Zlib Compression", access your Control Panel and search for the PHP Configuration menu. Alternatively, you can simply type "PHP" into the Search Bar at the top of your Control Panel page. In the newly opened PHP Configuration menu, search for the "Zlib Compression" field. Choose to either enable or disable it and click Save at the bottom of the menu.

How can I change my PHP version?

Your Hosting Account's PHP version can be changed at any time through your Control Panel. To change your PHP version, access your website's Control Panel and search for the PHP Configuration menu. You can also just type "PHP" into your Search Bar at the top of your Control Panel page. In the newly opened page, you can select the PHP version you wish to use with your Account. Choose the required PHP version and click Save at the bottom of the page.