Most of the website nowadays rely and build using PHP language and most of the hosting company provide PHP with their hosting services. As you know, PHP comes with customizable variable globally and also per user based. This article will help you to change PHP value for your website.

Viewing Your Current PHP Value

Before you make any changes to your PHP variable, you will need to see what is the current value for your PHP variable. You will need to have a PHP info page.

Read this article: How To Create PHP Info Page

It is also important for you to know how does PHP being load to your web server. You can have this info when you are able to access your PHP info page. There are two ways to load PHP

  1. as Apache modules
  2. CGI module

Each modules have it’s own way to process changes to the PHP variable.

PHP As Apache Module

If your server load PHP as an Apache module, you will be able to change PHP variable thru .htaccess. You can find .htaccess file inside your public_html folder. It is a hidden file. So you need to make sure that your account able to access this file. If you cannot find this file, you should be able to create it manually.

You will need to use the correct syntax. Please refer below:

php_value <Directive> <value>

For example you would like to change your memory_limit, you will need to specify as below:

php_value memory_limit 128M

 

PHP As CGI Module

If you find your server load PHP as CGI module, changes to PHP variable can only be done by creating php.ini file inside your public_html folder. However, you need to make sure that your server able to load this file recursive so the changes will affect inside all folders.

Now you need to create a php.ini file. The syntax will be the same as global php.ini.

<Directive> = <value>;

For example you would like to change your memory_limit, you will need to specify as below:

memory_limit = 128M;

Now you can refresh your PHP info page again. You should see your memory limit has been change to the value that you specify.

Show Buttons
Hide Buttons