Answers.Body: <p>We Always make a tar.gz from all the files, and a database backup of the drupal database and the civicrm database, without disabeling any modules.
  The we extract the files on the new location, and give the files and folder the right permissions (in most case 755 is good and do not forget the .htaccess). Then we ajust the settings.php and the civicrm.settings.php, with the correct paths and database connection information. Than we change the "Temporary directory" in the "File system" in drupal, and the paths in "Directories", "Resource URL's" and "Cache" in civicrm. Clear the cache again and that's it!</p>
  
  <p>Don not change anything on your current website!</p>
  
  <ul>
  <li>cd /var/www/html</li>
  <li>tar cvzf mywebsite.tar.gz mywebsite/</li>
  <li>mysqldump -u database_user_drupal -p database_name_drupal > database_name_drupal.sql</li>
  <li>mysqldump -u database_user_civicrm -p database_name_civicrm > database_name_civicrm.sql
  Copy everything to the new server and do</li>
  <li>tar -xvf mywebsite.tar.gz</li>
  <li>cp -rf mywebsite/ /var/www/html/mywebsitelocation</li>
  <li>chown -R username:www-data /var/www/html/mywebsitelocation/</li>
  <li>chmod -R 755 /var/www/html/mywebsitelocation (or 775 for testing)</li>
  <li>check the username of the DEFINER in the database_name.civicrm.sql
  
  <ul>
  <li>with:
  sed -n '/DEFINER/p' database_name.civicrm.sql</li>
  <li>remove it with:
  sed -i 's#DEFINER=<code>username</code>@<code>%</code># #g' database_name.civicrm.sql (replace username)</li>
  <li>and:
  sed -i 's#DEFINER=<code>username</code>@<code>localhost</code># #g' database_name.civicrm.sql (replace username)</li>
  <li>and:
  sed -i 's#SQL SECURITY DEFINER#SQL SECURITY INVOKER#g' database_name.civicrm.sql</li>
  </ul></li>
  <li>mysql -u new_database_user_drupal -p new_database_name_drupal &lt; database_name_drupal.sql</li>
  <li>mysql -u new_database_user_civicrm -p new_database_name_civicrm &lt; database_name_drupal.sql</li>
  <li>nano /var/www/html/mywebsitelocation/sites/default/settings.php
  
  <ul>
  <li>change the "$databases = array ("
  change the "$base_url =" (if set)</li>
  </ul></li>
  <li>nano /var/www/html/mywebsitelocation/sites/default/civicrm.settings.php
  
  <ul>
  <li>change "define( 'CIVICRM_UF_DSN'"</li>
  <li>change "define('CIVICRM_DSN'"</li>
  <li>change "$civicrm_root ="</li>
  <li>change "define( 'CIVICRM_TEMPLATE_COMPILEDIR'"</li>
  <li>change "define( 'CIVICRM_UF_BASEURL'"</li>
  <li>we do not use the "$civicrm_setting['Directory Preferences']" settings and "$civicrm_setting['URL Preferences']" settings in the civicrm.settings.php</li>
  </ul></li>
  <li>change the "Temporary directory" in the "File system" in drupal</li>
  <li>clear the cache, use the button in drupal</li>
  <li>"Reset Paths" on "civicrm/admin/setting/updateConfigBackend?reset=1"</li>
  <li>and you can clear the cache in civicrm also with the button on "civicrm/admin/setting/updateConfigBackend?reset=1"</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-07T10:20:26.333Z
Answers.Text: Thank you Jan-Derek for responding. I did pretty much what you outlined. I tried changing the Drupal temporary directory. I cannot update the paths in  "Directories", "Resource URL's" and "Cache" in civicrm, as every time I try I get the page not found error. I have cleared the cache a 100 times!
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-07T10:47:37.847Z
Answers.Text: The drupal pages are working ? Can you go direct to /civicrm/admin/setting/updateConfigBackend?reset=1 ?
Answers.UserDisplayName: Jan-Derek Vos
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-07T12:00:26.650Z
Answers.Text: Thanks again for expanding on your answer. The Drupal pages are working and I have followed all the steps that you have outlined, but I cannot go directly to  /civicrm/admin/setting/updateConfigBackend?reset=1 as any path beginning with /civicrm gives me the same page not found error.
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-07T12:05:46.800Z
Answers.Text: And ?q=civicrm/admin/setting/updateConfigBackend&reset=1
Answers.UserDisplayName: Jan-Derek Vos
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-07T12:11:17.547Z
Answers.Text: What for version of php are you using on the other server? And you use apache on the other server?
Answers.UserDisplayName: Jan-Derek Vos
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-07T13:24:33.487Z
Answers.Text: The ?q=civicrm/admin/setting/updateConfigBackend&reset=1 path does not work either. I am using apache on both servers and php 5.6 on both servers as well.
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-08T00:57:00.370Z
Answers.Text: Did you change the path in this file also? civicrm.settings.php, it solved my problem, http://vuxi.com/vxdta/drupal/getting-errors-when-moving-d7-civicrm-install-form-localhost-xampp-portable-to-another-location/
Answers.UserDisplayName: Bruno  Vincent
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-08T12:26:50.513Z
Answers.Text: You can check always the apache and php error logs
Answers.UserDisplayName: Jan-Derek Vos
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-10T08:16:44.770Z
Answers.Text: Thanks again for your input (Bruno and Jan-Derek). I have already changed the paths in the civicrm.settings.php file. I also checked the Apache and PHP error logs which didn't give any clues. I think it is something to do with the server configuration. I tried to do a completely new install of Civi, on a fresh Drupal installation, and although the Drupal installation works fine when I go to the install page at /sites/all/modules/civicrm/install/index.php this is also coming up as Page Not Found.
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-10T09:18:40.873Z
Answers.Text: it is weird that drupal works and civicrm not, you sould think that it maybe has something to do with .htaccess, but because drupal works it can not be.
Answers.UserDisplayName: Jan-Derek Vos
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-10T14:14:26.347Z
Answers.Text: I reinstalled Apache and PHP with the latest releases using easy Apache on the WHM panel. I have now been able to install a new copy of CiviCRM with Drupal, but still can't get the copy of the live site to work.
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-18T12:00:23.487Z
Answers.Text: I also forgot that you need to replace the "DEFINER" "user" in the sql export of the civicrm database, or the database username must be the same on both servers !
Answers.UserDisplayName: Jan-Derek Vos
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-19T10:44:00.160Z
Answers.Text: Nice walkthrough, i think you can remove the 'DEFINER' with only 1 line  : sed -i '' 's/DEFINER=[^*]*\*/\*/g' database_file.sql
Answers.UserDisplayName: empiguet
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-07T09:45:02.387Z
Answers.LastActivityDate: 2018-09-18T12:06:14.167Z
Answers.LastEditDate: 2018-09-18T12:06:14.167Z
Answers.UserDisplayName: Jan-Derek Vos
Body: <p>I wanted to do some testing on my CiviCRM site (on Drupal) and so copied everything over to another server. I am using CiviCRM 5.3.1 with Drupal 7.59.</p>
  
  <p>I followed the steps in the "<a href="https://docs.civicrm.org/sysadmin/en/latest/misc/switch-servers/" rel="nofollow noreferrer">Moving an Existing Installation to a New Server or Location</a>" guide but after re-enabling CiviCRM, when I try to navigate to any CiviCRM page I get an error in Drupal saying "Page Not Found". The CiviCRM menu link does appear in the admin menu and no errors are showing when I enable the CiviCRM module. </p>
  
  <p>I have removed all the log files including the Config.IDS.ini file from the ConfigandLog folder, as well as emptying the templates_c folder. I did copy the civicrm.settings.php file over, but have updated all the paths in this file as well as updating all the entries in settings.php. I aslo emptied all the cache tables in the Civi database. </p>
  
  <p>I have not been able to review and update directory paths and base URLs because of the page not found error. Not sure if I am able to do this using Drush?</p>
  
  <p>I have checked the error logs for any clues, but haven't found any. There is one javascript error which comes up, which I'm not sure is relevant or not: </p>
  
  <blockquote>
    <p>index.php?q=civicrm/admin:1 Refused to execute script from '<a href="http://.../civicrm/ajax/l10n-js/en_US?r=4hXrp" rel="nofollow noreferrer">http://.../civicrm/ajax/l10n-js/en_US?r=4hXrp</a>' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.</p>
  </blockquote>
  
  <p>Seems like I have missed something but I don't know what!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-07T10:48:35.197Z
Comments.Text: Can enable clean url?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-11T07:58:43.540Z
Comments.Text: Yes, it is possible to enable clean urls
Comments.UserDisplayName: Ben
Tags: <drupal><error><installation><webserver>
Title: CiviCRM Page Not Found Error After Copying Site to New Server
ThreadText: # CiviCRM Page Not Found Error After Copying Site to New Server
  
  (Asked by: username_0 on 2018-09-07)
  
  I wanted to do some testing on my CiviCRM site (on Drupal) and so copied everything over to another server. I am using CiviCRM 5.3.1 with Drupal 7.59.
  
  I followed the steps in the "[Moving an Existing Installation to a New Server or Location](https://docs.civicrm.org/sysadmin/en/latest/misc/switch-servers/)" guide but after re-enabling CiviCRM, when I try to navigate to any CiviCRM page I get an error in Drupal saying "Page Not Found". The CiviCRM menu link does appear in the admin menu and no errors are showing when I enable the CiviCRM module.
  
  I have removed all the log files including the Config.IDS.ini file from the ConfigandLog folder, as well as emptying the templates\_c folder. I did copy the civicrm.settings.php file over, but have updated all the paths in this file as well as updating all the entries in settings.php. I aslo emptied all the cache tables in the Civi database.
  
  I have not been able to review and update directory paths and base URLs because of the page not found error. Not sure if I am able to do this using Drush?
  
  I have checked the error logs for any clues, but haven't found any. There is one javascript error which comes up, which I'm not sure is relevant or not:
  
  > index.php?q=civicrm/admin:1 Refused to execute script from '<http://.../civicrm/ajax/l10n-js/en_US?r=4hXrp>' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
  
  Seems like I have missed something but I don't know what!
  
  **Tags:** drupal, error, installation, webserver
  
  > **Comments:**
  > **username_1**: Can enable clean url?  
  > **username_0**: Yes, it is possible to enable clean urls  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-09-07. Score: 3
  
  We Always make a tar.gz from all the files, and a database backup of the drupal database and the civicrm database, without disabeling any modules.
  The we extract the files on the new location, and give the files and folder the right permissions (in most case 755 is good and do not forget the .htaccess). Then we ajust the settings.php and the civicrm.settings.php, with the correct paths and database connection information. Than we change the "Temporary directory" in the "File system" in drupal, and the paths in "Directories", "Resource URL's" and "Cache" in civicrm. Clear the cache again and that's it!
  
  Don not change anything on your current website!
  
  * cd /var/www/html
  * tar cvzf mywebsite.tar.gz mywebsite/
  * mysqldump -u database\_user\_drupal -p database\_name\_drupal > database\_name\_drupal.sql
  * mysqldump -u database\_user\_civicrm -p database\_name\_civicrm > database\_name\_civicrm.sql
    Copy everything to the new server and do
  * tar -xvf mywebsite.tar.gz
  * cp -rf mywebsite/ /var/www/html/mywebsitelocation
  * chown -R username:www-data /var/www/html/mywebsitelocation/
  * chmod -R 755 /var/www/html/mywebsitelocation (or 775 for testing)
  * check the username of the DEFINER in the database\_name.civicrm.sql
    + with:
      sed -n '/DEFINER/p' database\_name.civicrm.sql
    + remove it with:
      sed -i 's#DEFINER=`username`@`%`# #g' database\_name.civicrm.sql (replace username)
    + and:
      sed -i 's#DEFINER=`username`@`localhost`# #g' database\_name.civicrm.sql (replace username)
    + and:
      sed -i 's#SQL SECURITY DEFINER#SQL SECURITY INVOKER#g' database\_name.civicrm.sql
  * mysql -u new\_database\_user\_drupal -p new\_database\_name\_drupal < database\_name\_drupal.sql
  * mysql -u new\_database\_user\_civicrm -p new\_database\_name\_civicrm < database\_name\_drupal.sql
  * nano /var/www/html/mywebsitelocation/sites/default/settings.php
    + change the "$databases = array ("
      change the "$base\_url =" (if set)
  * nano /var/www/html/mywebsitelocation/sites/default/civicrm.settings.php
    + change "define( 'CIVICRM\_UF\_DSN'"
    + change "define('CIVICRM\_DSN'"
    + change "$civicrm\_root ="
    + change "define( 'CIVICRM\_TEMPLATE\_COMPILEDIR'"
    + change "define( 'CIVICRM\_UF\_BASEURL'"
    + we do not use the "$civicrm\_setting['Directory Preferences']" settings and "$civicrm\_setting['URL Preferences']" settings in the civicrm.settings.php
  * change the "Temporary directory" in the "File system" in drupal
  * clear the cache, use the button in drupal
  * "Reset Paths" on "civicrm/admin/setting/updateConfigBackend?reset=1"
  * and you can clear the cache in civicrm also with the button on "civicrm/admin/setting/updateConfigBackend?reset=1"
  
  > **Comments:**
  > **username_0**: Thank you username_2 for responding. I did pretty much what you outlined. I tried changing the Drupal temporary directory. I cannot update the paths in  "Directories", "Resource URL's" and "Cache" in civicrm, as every time I try I get the page not found error. I have cleared the cache a 100 times!  
  > **username_2**: The drupal pages are working ? Can you go direct to /civicrm/admin/setting/updateConfigBackend?reset=1 ?  
  > **username_0**: Thanks again for expanding on your answer. The Drupal pages are working and I have followed all the steps that you have outlined, but I cannot go directly to  /civicrm/admin/setting/updateConfigBackend?reset=1 as any path beginning with /civicrm gives me the same page not found error.  
  > **username_2**: And ?q=civicrm/admin/setting/updateConfigBackend&reset=1  
  > **username_2**: What for version of php are you using on the other server? And you use apache on the other server?  
  > **username_0**: The ?q=civicrm/admin/setting/updateConfigBackend&reset=1 path does not work either. I am using apache on both servers and php 5.6 on both servers as well.  
  > **username_3**: Did you change the path in this file also? civicrm.settings.php, it solved my problem, http://vuxi.com/vxdta/drupal/getting-errors-when-moving-d7-civicrm-install-form-localhost-xampp-portable-to-another-location/  
  > **username_2**: You can check always the apache and php error logs  
  > **username_0**: Thanks again for your input (username_3 and username_2). I have already changed the paths in the civicrm.settings.php file. I also checked the Apache and PHP error logs which didn't give any clues. I think it is something to do with the server configuration. I tried to do a completely new install of Civi, on a fresh Drupal installation, and although the Drupal installation works fine when I go to the install page at /sites/all/modules/civicrm/install/index.php this is also coming up as Page Not Found.  
  > **username_2**: it is weird that drupal works and civicrm not, you sould think that it maybe has something to do with .htaccess, but because drupal works it can not be.  
  > **username_0**: I reinstalled Apache and PHP with the latest releases using easy Apache on the WHM panel. I have now been able to install a new copy of CiviCRM with Drupal, but still can't get the copy of the live site to work.  
  > **username_2**: I also forgot that you need to replace the "DEFINER" "user" in the sql export of the civicrm database, or the database username must be the same on both servers !  
  > **username_4**: Nice walkthrough, i think you can remove the 'DEFINER' with only 1 line  : sed -i '' 's/DEFINER=[^*]*\*/\*/g' database_file.sql  
  
  ---
  
  