Knowledgebase: PHP
How do I set php.ini variables for my application?
Posted by Arvand Sabetian (Import) on 18 July 2009 08:39 PM
This is for Linux hosting accounts only!

Related documents:
  1. Howto optimize your PHP installation to handle large file uploads.

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();
?>
(149 vote(s))
Helpful
Not helpful

Comments (7)
Eric Peckham
19 November 2009 12:30 PM
This doesn't appear to work on ASP (Windows).

RESPONSE: Yes, unfortunately, you can not set your own php.ini variables on Windows. Please purchase a linux account or request the change through our support.
Ruban Kumar
07 March 2010 01:33 AM
i put a file inside the public_html where my script is ( adult video script ) but the script do not take the change, i don't understand?

please help me!

RESPONSE: You can test and see if your environment is taking the changes inside php.ini by simply creating a blank file with the following inside: <? phpinfo(); ?> and then saving it as phpinfo.php and uploading it. Then, visit phpinfo.php to see if the new variable values are present.
simon newbound
06 December 2010 10:08 AM
This is a converstation with your support where i wanted an answer and came away totally confussed?

Day 5 UNABLE TO LOGON TO MY SLIDESHOW

Contact your host to find out what session save path to use, then add this to config/user_setup.php:


1.
session_save_path('/path/they/give/you');
Be sure to add that line before the closing PHP tag:


1.
?>


THIS IS THE CONVERSATION WITH MY HOSTING COMPANY REGARDING SESSION SAVE PATH.
CAN ANYBODY ASSIST ME DECODING IT PLEASE:

i have been having problem with slideshow director so i need to know my session path please for example
19:46newbound: SESSION SAVE PATH
A common use of this file is to set a custom session save path, as required by your host.
Uncomment out the line below and replace the path with your host's session
save path.
*/

// session_save_path('/path/from/your/host');

19:49Nivin Philip: session.save_path is /tmp

19:50Nivin Philip: please see http://stats.lizard.arvixe.com/phpinfo.php

19:50newbound: please can you replace this line of text with what it should be please

19:50newbound: // session_save_path('/path/from/your/host');

19:51Nivin Philip: sorry, it can not be done server wide

19:51Nivin Philip: you can customize your own php.ini

19:51Nivin Philip: please see https://support.arvixe.com/index.php?/K … pplication

19:52newbound: this is my own php

19:52Nivin Philip: please see the above

19:52newbound: session.save_path is /tmp


19:53newbound: this is exactly it ?


19:53Nivin Philip: yes

19:53newbound: so i remove this line of code // session_save_path('/path/from/your/host'); and replace it with session.save_path is /tmp


19:54newbound: does the full stop underscore make a difference can i use both

19:54newbound: yours is full stop mine is under score


19:55Nivin Philip: give it in your php.ini

19:55Nivin Philip: session.save_path

19:55Nivin Philip: and the corresponding value


19:56newbound: Pease what do i paste into my config php


19:56Nivin Philip: Is there anything else I can assist you with today?


19:56newbound: session.save_path is /tmp


i just copy this letter for letter ?


19:56Nivin Philip: it will be session.save_path

19:56Nivin Philip: you can try both

19:57newbound: ok thanks , bye

19:57Nivin Philip: You're welcome! Have a nice day! And thank you for choosing Arvixe.

Nivin Philip has left the conversation



Kindly Simon
Juan Luis Carpinteiro
14 April 2014 06:40 PM
im using joomla 3 and i have a problem in my control panel. it says that my host has to disable magic quotes because joomla 3 doesnt support them. how can i fix this ? please help.
thanks
Michael Carr
16 April 2014 07:58 AM
This is normally done in a local php.ini file. If you create a support ticket, I am sure we can do it for you.

http://docs.joomla.org/How_to_turn_off_magic_quotes_gpc_for_Joomla_3
Juan Jose Martinez Cuervo
23 December 2014 05:45 PM
im in the same case that Juan Luis carpinteiro, i need to disable magic quotes because joomla 3 doesnt support them. how can i fix this ? please help.
thanks
Michael Carr
02 January 2015 01:42 PM
You can try following the steps in the guide or contact our support. Most of our servers have magic_quotes disabled by default.
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).