Loading...

Knowledge Base

How do I set php.ini variables for my application?

This is for Linux hosting accounts only!

Since we run PHP as CGI, you can create your own php.ini and place it beside your scripts. So simply create a blank file named php.ini and put the following inside:

[PHP]
variable = value;
variabl2 = value2;

Where variable and variable2 are php.ini variables. For example, if you need to set the memory_limit to 128M and post_max_size to 64M, you would put the following inside your php.ini file -

[PHP]
memory_limit = 128M;
post_max_size = 64M;

Here is another example of a php.ini file content:

[PHP]
max_execution_time = 60
memory_limit = 256M
upload_max_filesize = 256M
post_max_size =  256M


Make sure to upload the php.ini beside the script that is being called from the browser. The php.ini must exist in the same directory.

More common variables are:
    *  file_uploads
    * upload_max_filesize
    * max_input_time
    * memory_limit
    * max_execution_time
    * post_max_size

After you created the php.ini file, you can now create the phpinfo.php file with these 3 lines in it, which will show you if the settings you created are correct:

<?php
phpinfo();
?>

Did you find this article helpful?

 
* Your feedback is too short

Loading...