J3.x

How to turn off magic quotes gpc: Difference between revisions

From Joomla! Documentation

Leolam (talk | contribs)
Cmb (talk | contribs)
Corrected relevent to relevant.
 
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{warning|Magic Quotes was a feature deprecated in PHP 5.3 and removed in Joomla 5.4 and higher. This documentation page is only relevant for Joomla 3 users still running PHP 5.3}}


== For MAMP ==
== For MAMP ==
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.


== For most mainstream hosting companies running a CGI-Webinterface ==
== For Most Mainstream Hosting Companies Running a CGI-Webinterface ==
Steps:
Steps:
* Create a php.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) :
* 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 :
<pre><IfModule mod_suphp.c>
<pre><IfModule mod_suphp.c>
   suPHP_ConfigPath /home/myusername/public_html/yourJ3folder
   suPHP_ConfigPath /home/myusername/public_html/yourJ3folder
Line 24: Line 24:
Change "myusername" and "yourJ3folder" to your respective folders. The "/home/myusername/public_html/yourJ3folder" can be found via the Global Configuration:
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).
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 ==
== ''.htaccess'' for Some Hosts ==


For some hosts, add "php_flag magic_quotes_gpc off" to the .htaccess file
For some hosts, add the following to the .htaccess file in the root of your site (for example ''/home/myusername/public_html/.htaccess'')
<pre>
php_flag magic_quotes_gpc off
</pre>
<noinclude>[[Category:Server configurations]]</noinclude>
<noinclude>[[Category:Server configurations]]</noinclude>
== Yet Another Solution For Shared Hosts ==
* create a <code>php.ini</code> 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 <code>.htaccess</code> file and add this line at the top and save the file
<code>SetEnv PHPRC /home/youruser/public_html/php.ini</code>
* Test if the error message goes away
source : http://stackoverflow.com/questions/517008/how-to-turn-off-magic-quotes-on-shared-hosting
== Another Solution (for the Hosts Where PHP is Running as FCGI Module) ==
Works for PHP 5.3 and higher
* create a <code>.user.ini</code> file at your Joomla! root.
* Add this content to the file and save
magic_quotes_gpc = Off

Latest revision as of 20:08, 16 September 2022

Warning!

Magic Quotes was a feature deprecated in PHP 5.3 and removed in Joomla 5.4 and higher. This documentation page is only relevant for Joomla 3 users still running PHP 5.3


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 the following to the .htaccess file in the root of your site (for example /home/myusername/public_html/.htaccess)

php_flag magic_quotes_gpc off

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

Another Solution (for the Hosts Where PHP is Running as FCGI Module)

Works for PHP 5.3 and higher

  • create a .user.ini file at your Joomla! root.
  • Add this content to the file and save
magic_quotes_gpc = Off