Php.ini

software development

#1

I’m trying to create a custom php.ini file as instructed here:

Firstly, I like to be able to view the existing /etc/php53/php.ini so I can copy/paste all the content to the new php.ini file then make the new php.ini file under /.php/5.3 I will add lines to increase the memory.

however, I have no idea how to actually see the content of the /etc/php53/php.ini as in my FTP I can’t see the /etc directory.

Would you please help as how I can find this directory or view the existing code inside the /etc/php53/php.ini .

Any help greatly appreciated,
Thanks,


#2

If all you need to do is change the memory_limit, you don’t need to write a new php.ini. Just use a phprc (as detailed on the wiki a few lines above the part you’re looking at) and set memory_limit in there.

If you must know what’s in there, you can write a quick PHP script to display the contents of the system php.ini like so:

<?php header("Content-Type: text/plain"); readfile("/etc/php53/php.ini");

Note that we may change the settings in the system php.ini if necessary in the future, so you really shouldn’t depend on using a copy of it unless you really have to.


#3

Thanks for the quick reply,
I just ran the little script to get the php.ini and it did work, however, I like to follow your advice as not to make a custom php.ini and go with the phprc but I just have afew questions:

  1. is the phprc to be located here? .php/5.3/phprc
  2. do I need to give the file any extensions (ie. phprc.php) or nothing at all?
  3. What’s the proper way of defining the memory limit in this file?
  4. How can I in general know how much of memory is allocated to my PHP at any given time? (in other words, how would I know if the new memory linit is actually taking effect or not?)

Thanks for the help


#4
  1. Correct, that’s where it goes. Note that this is under the “root level” of your FTP account, not under any of your domain directories. (As such, it will affect all domains under your user.)

  2. No extension, just “phprc”.

  3. memory_limit = 123M

  4. Easiest way is by using another simple PHP script:

This dumps all the configuration settings which PHP is operating with.