Actions

Difference between revisions of "How to turn off magic quotes gpc for Joomla 3"

From Joomla! Documentation

(Yet Another Solution For Shared Hosts)
m (Typo and update PHP version to what I hope people are using :P)
(2 intermediate revisions by one user not shown)
Line 3: Line 3:
 
Steps:
 
Steps:
 
* Go to MAMP application >> Preferences (button) >> PHP (tab) >> Choose 5.3.1 or greater >> choose OK.
 
* Go to MAMP application >> Preferences (button) >> PHP (tab) >> Choose 5.3.1 or greater >> choose OK.
* Go to the MAMP folder >> bin >> php >> php5.3.6 >> conf >> edit php.ini >> add "magic_quotes_gpc = Off" a few lines above "magic_quotes_sybase = Off".
+
* Go to the MAMP folder >> bin >> php >> php5.3.26 >> conf >> edit php.ini >> add "magic_quotes_gpc = Off" a few lines above "magic_quotes_sybase = Off".
 
* Restart MAMP's servers.
 
* Restart MAMP's servers.
  
Line 11: Line 11:
 
* Create a php.ini or php5.ini file with the following:
 
* Create a php.ini or php5.ini file with the following:
 
<pre>magic_quotes_gpc = Off
 
<pre>magic_quotes_gpc = Off
extension=pdo.so
+
</pre>
extension=pdo_mysql.so</pre>
+
  
 
* Put it in your Joomla 3 root. Then change the htaccess.txt in your Joomla 3 root to .htaccess. Add the following lines to the .htaccess file (at the top), don't forget to change php.ini to php5.ini when applicable :
 
* Put it in your Joomla 3 root. Then change the htaccess.txt in your Joomla 3 root to .htaccess. Add the following lines to the .htaccess file (at the top), don't forget to change php.ini to php5.ini when applicable :
Line 40: Line 39:
 
  magic_quotes_runtime = Off
 
  magic_quotes_runtime = Off
 
  magic_quotes_sybase = Off
 
  magic_quotes_sybase = Off
extension=pdo.so
+
* Edit your <code>.htaccess</code> file and add this line at the top and save the file
extension=pdo_mysql.so
+
* Edit your <code>.htaces</code> file and add this line at the top and save the file
+
 
<code>SetEnv PHPRC /home/youruser/public_html/php.ini</code>
 
<code>SetEnv PHPRC /home/youruser/public_html/php.ini</code>
 
* Test if the error message goes away
 
* Test if the error message goes away
  
 
source : http://stackoverflow.com/questions/517008/how-to-turn-off-magic-quotes-on-shared-hosting
 
source : http://stackoverflow.com/questions/517008/how-to-turn-off-magic-quotes-on-shared-hosting

Revision as of 18:27, 21 October 2013

Contents

For MAMP

Steps:

  • Go to MAMP application >> Preferences (button) >> PHP (tab) >> Choose 5.3.1 or greater >> choose OK.
  • Go to the MAMP folder >> bin >> php >> php5.3.26 >> conf >> edit php.ini >> add "magic_quotes_gpc = Off" a few lines above "magic_quotes_sybase = Off".
  • Restart MAMP's servers.


For most mainstream hosting companies running a CGI-Webinterface

Steps:

  • Create a php.ini or php5.ini file with the following:
magic_quotes_gpc = Off
  • Put it in your Joomla 3 root. Then change the htaccess.txt in your Joomla 3 root to .htaccess. Add the following lines to the .htaccess file (at the top), don't forget to change php.ini to php5.ini when applicable :
<IfModule mod_suphp.c>
  suPHP_ConfigPath /home/myusername/public_html/yourJ3folder
  <Files php.ini>
    order allow,deny
    deny from all
  </Files>
</IfModule>

Change "myusername" and "yourJ3folder" to your respective folders. The "/home/myusername/public_html/yourJ3folder" can be found via the Global Configuration:

In Joomla backend > System > System Information > [Directory Permissions], the folder is usually the same as the log directory (but without /logs at the end).


.htaccess for some hosts

For some hosts, add "php_flag magic_quotes_gpc off" to the .htaccess file

Yet Another Solution For Shared Hosts

  • create a php.ini file at your Joomla! root.
  • Add this content to the file and save
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
  • Edit your .htaccess file and add this line at the top and save the file

SetEnv PHPRC /home/youruser/public_html/php.ini

  • Test if the error message goes away

source : http://stackoverflow.com/questions/517008/how-to-turn-off-magic-quotes-on-shared-hosting