On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Quote from: twz at Sep 18, 2009, 05:56 AM

    So I suppose I’ll need to use a copy of the host’s main php.ini, and just change the bits I want??

    Either way, it still doesn’t explain why it has been working ok up until now.


    Possibly the host’s php.ini changed.

    Here’s some code I found to copy the hosts main php.ini and make your modifications to it. I don’t know if it will work at your host:

    <?php
    // Put all the php.ini parameters you want to change below. One per line.
    // Follow the example format $parm[] = "parameter = value";
    $parm[] = "register_globals = Off";
    $parm[] = "session.use_trans_sid = 0";
    // full unix path - location of the default php.ini file at your host
    // you can determine the location of the default file using phpinfo()
    $defaultPath = "/usr/local/lib/php.ini"; 
    // full unix path - location where you want your custom php.ini file
    $customPath = "/home/user/public_html/php.ini";
    // nothing should change below this line.
    if (file_exists($defaultPath)) {
      $contents = file_get_contents($defaultPath); 
      $contents .= "\n\n; USER MODIFIED PARAMETERS FOLLOW\n\n";  
      foreach ($parm as $value) $contents .= $value . " \n";
      if (file_put_contents($customPath,$contents)) {
        if (chmod($customPath,0600)) $message = "The php.ini file has been modified and copied";
          else $message = "Processing error - php.ini chmod failed";
      } else {
        $message = "Processing error - php.ini write failed";
      }
    } else {
      $message = "Processing error - php.ini file not found";
    }
    echo $message;
    ?>  
    
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
    • Thanks guys - problem solved. The host put a copy of the main php.ini into /manager/ with the changes I wanted.

      Although they still haven’t said what they changed, I suspect the problem started when they installed suhosin (which has many entries in phpinfo() - I don’t remember seeing it there before).

      I’ve also grabbed a copy of that code BobRay - for when the host changes something else and it breaks again.
      • Hello twz-17...

        Do you have a copy of the php.ini that the host upload?
        I'm having the same problem, i follow the whole conversation and change the manager/php.ini file name works, THANK YOU for this post, is help full, and grate found it after 8 hours trying to find an answer!!!! NICE!!! smiley

        I check other ModX sites and those does not have a manager/php.ini, so i think is not necessary!
        in that case i just delete it!

        THANK YOU!!!! [ed. note: Ysanmiguel last edited this post 7 years ago.]
          --
          ysanmiguel.com
        • I'd suggest renaming it instead of deleting it. Sometimes (not often) the host puts things in there that are important.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
          • Thank you BOB.

            there was a php.ini because suexec was installed in the server. the hp.ini only has register global off, and that was all. But that php.ini was the trouble!

            In my case find that php.ini was MAGIC, because I was looking for info for ages!
            but may be if the content is more complex inside the php file, off course it might have something important!

            Thank you Bob!
              --
              ysanmiguel.com
            • I'm glad I could help. smiley
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
              • Excellent BOB, I see you many times here in the forum, and thank you very much, you are a huge help!!!
                  --
                  ysanmiguel.com