0
Welcome Guest! Login
0 items Join Now

Magic Quotes Off

  • Magic Quotes Off

    Posted 17 years 9 months ago
    • Ok, I am a newbie and yes I've read files and forums and all sorts of stuff and tired all sorts of stuff

      BUT I still can't get magic_quotes_gpc to turn on.

      I've tried putting the code in the .htaccess file but that just causes 500 error.

      Can anyone give me a few pointers?

      I'm running Unix FreeBSD 6.

      It's a nightmare
  • Re: Magic Quotes Off

    Posted 17 years 9 months ago
    • What is magic_quotes_gpc?
  • Re: Magic Quotes Off

    Posted 17 years 9 months ago
  • Re: Magic Quotes Off

    Posted 17 years 9 months ago
    • It sounds like you may be on a server that uses phpsuexec (that is good). PHP flags in .htaccess will throw 500 errors if that is the case.

      What you will need to do is create php.ini overrides to flag magic quotes on. Then a copy of that php.ini overriding the servers php.ini will have to reside in every single subdirectory (100s of directories :o ).

      This may all sound daunting, but it is not. Here are the options:
      • Ask your webhost to do it--they may or may not be willing to do it
      • Employ ssh access and do it via a terminal--but you probably don't have access to all the you need access to
      • Employ a pair of scripts. The first finds the server php.ini, makes a copy, modifies it, and put a copy in you public html folder. The second makes copies in every subdirectory

      If you need to go with number three, post back and I will find the scripts for you (I have used them but haven't used them for awhile since I have my own server--another solution). They work.

      Regardless the solution, you will need to add the override to any subdirectory that you create in the future (as when you add an extension).

      Steve
    • Last Edit: 17 years 9 months ago by Stephen O Connor.
  • Re: Magic Quotes Off

    Posted 17 years 9 months ago
    • Ok Stephen thanks for your valuable feedback!

      I think I'll go with option 3 so it can copy new php.ini everytime I have a new subfolder.

      I doubt my hosting provider will do this for me.

      Please let me know more about optin 3.

      Thanks for your help.

      BEN
  • Re: Magic Quotes Off

    Posted 17 years 9 months ago
    • Good info Stephen. Ahh..the more you know. :)
  • Re: Magic Quotes Off

    Posted 17 years 9 months ago
    • You may have to do something slightly different (like the pathway to the php.ini and of course your username where it says /home/yourusername/public_html/php.ini)

      In a text editor make a file and save it as something like phpoverride.php

      Paste:
      <?php
      // Put all the php.ini parameters you want to change below. One per line.
      // Follow the example format $parm[] = "parameter = value";
      $parm[] = "magic_quotes_gpc = On";
      //$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/Zend/etc/php.ini'; 
      // full unix path - location where you want your custom php.ini file
      $customPath = "/home/yourusername/public_html/php.ini";
      // nothing should change below this line.
      if (file_exists($defaultPath)) {
      &nbsp; $contents = file_get_contents($defaultPath); 
      &nbsp; $contents .= "\n\n; USER MODIFIED PARAMETERS FOLLOW\n\n";&nbsp; 
      &nbsp; foreach ($parm as $value) $contents .= $value . " \n";
      &nbsp; $handle = fopen($customPath, 'w'); 
      &nbsp; if (fwrite($handle, $contents)) { 
      &nbsp; &nbsp; fclose($handle);
      &nbsp; &nbsp; if (chmod($customPath,0600)) $message = "The php.ini file has been modified and copied";
      &nbsp; &nbsp; &nbsp; else $message = "Processing error - php.ini chmod failed";
      &nbsp; } else {
      &nbsp; &nbsp; $message = "Processing error - php.ini write failed";
      &nbsp; }
      } else {
      &nbsp; $message = "Processing error - php.ini file not found";
      }
      echo $message;
      ?>

      This will place an altered override of the server's php.ini in your public.html folder. If it doesn't work, you will need to work with your isp to get some of the values right.

      Upoad it to your public_html folder

      With our browser, go to yourwebsite.com/phpoverride.php and the script will run (if all is correct--again your host should be able to help you if it doesn't--if not consider another host).

      Now make another file in a text editor and name it something like overridecopy.php Paste in the following:

      <?php 
      //*set*this*value*to*Y*if*you*only*want*to*overwrite*old*php.ini*files 
      //*set*this*value*to*N*if*you*want*to*put*a*php.ini*file*in*every*directory 
      $overwriteOnly*=*"Y"; 
       
      if*($overwriteOnly*==*"Y")*echo*"Operating*in*Overwrite*Only*Mode<br><br>"; 
      $path*=*"/home/"*.*get_current_user()*.*"/public_html"; 
      $source*=*$path*.*"/php.ini"; 
      if*(!file_exists($source))*die('Error*-*no*source*php.ini*file'); 
      function*search($dir)*{ 
      **global*$source; 
      **global*$overwriteOnly; 
      **$dh*=*opendir($dir); 
      **while*(($filename*=*readdir($dh))*!==*false)*{ 
      ****if*(*$filename*!==*'.'*AND*$filename*!==*'..'*AND*$filename*!==*'cgi-bin'*AND*is_dir("$dir/$filename")*)*{ 
      ******$path*=*$dir."/".$filename;* 
      ******$target*=*$path*.*"/php.ini"; 
      ******if*(!file_exists($target)*AND*$overwriteOnly*==*"Y")*{ 
      ********echo*"$path*<b>skipped*-*no*php.ini*file</b><br>"; 
      ******}*else*{ 
      ********echo*"$target*<br>"; 
      ********if*(!copy($source,$target))*echo*"<b>Write*failed*for*$target*</b><br>";
      ********if*(file_exists($target))*chmod($target,0600); 
      ****} 
      ******search($path); 
      ****} 
      **} 
      **closedir($dh); 
      } 
      search($path); 
      echo*"<br>Done."; 
      ?>


      Upload it to your public_html folder

      Again, go to your browser and go to: yourwebsite.com/overridecopy.php

      If all is right, it will copy the override into all subdirectories.

      It may require tweaks.

      Steve
    • Last Edit: 17 years 9 months ago by Stephen O Connor.
  • Re: Magic Quotes Off

    Posted 17 years 9 months ago
    • Whoa--wrong button

      Read above post--I'm too doggone tired!

      Steve
    • Last Edit: 17 years 9 months ago by Stephen O Connor.
    • Mack's Avatar
    • Mack
    • Elite Rocketeer
    • Posts: 535
    • Thanks: 0

    Re: Magic Quotes Off

    Posted 17 years 9 months ago
    • Who is your host provider?
  • Re: Magic Quotes Off

    Posted 17 years 8 months ago
    • Aplus.net

Time to create page: 0.066 seconds