0

When I migrate or restore a Drupal 6 site Always php version I have set in the account page of the shared hosting service has been automatically changed.

For example, though I have set php 5.3 for example.com when I restore the site using exactly the same domain, files, db and the host after the restoration php version is set to php 5.1

Also after the restoration php.ini file gets set back to OFF though it was set to "On" before the restration.

I contacted the shared hosting company but they say I should check the .htaccess file that overrides the php setting.

Does Drupal do this?

3
  • Drupal comes with its own .htaccess file. You can see it between the files you find in the installation archive.
    – avpaderno
    Commented Apr 12, 2014 at 3:59
  • Note the PHP requirements for Drupal 6: "PHP 5.2.x only. Warning: support for PHP 4.x has been dropped. PHP 5.3 and later may produce errors or unexpected behaviour." - drupal.org/requirements Commented Apr 12, 2014 at 5:25
  • What is the name of your hosting company? Commented Apr 12, 2014 at 10:39

2 Answers 2

3

Does Drupal override php setting by it self by .htaccess?

No. Nor does it do it by any other method.

As pointed out in the comment by kiamlaluno, Drupal comes with its own .htaccess file. You'll find it as one the files in your Drupal root. You can read through it yourself and see that it does not change the setting of PHP version that you set in the account page of your shared hosting service.

The .htaccess overrides some settings that may be set different in php.ini, as shown in the directives below (copied from the default .htaccess file), but not anything else. As you can see, it has IfModule directives that makes the overrides contigent on the versions of PHP and Apache you use, rather than overriding the version.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

The changes you ask about cannot be explained by the Drupal .htaccess-file or anything else done by Drupal. Nor do I know about any backup/restore program or migration program for Drupal that does such things as those you describe.

3

If you use Bluehost for instance, and change PHP version in the control panel, it will overwrite Drupal's root .htaccess file, although I believe a backup is made.

What you need to do is this:

  1. Rename Drupal's root .htaccess file.
  2. Change PHP version in the control panel (5.2 recommended for Drupal 6).
  3. Open up the new .htaccess file and copy the info in it into Drupal's .htaccess file. Should be something like AddHandler application/x-httpd-php52 .php. Rename or delete this file.
  4. Rename Drupal's .htaccess file back to .htaccess and everything should be working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.