欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

让你的DRUPAL 6网站准备运行在PHP 5.6 有大用

下降不是唯一的东西是运动的;所以是PHP。如果你有一个Drupal 6网站,你最有可能运行PHP 5.3以上版本停止在2014或之前的支持。现在,PHP 5.5已经搬出了积极的支持,一些主机,例如Acquia,放弃了任何老的站点将被强制升级的支持,准备好了没有。好消息是,Drupal 6可以用PHP 5.6的工作,这是积极支持。Drupal 6核心只需要几片但是很多贡献模块将需要更新和/或修补。

获得一个基准

那么,补丁和更新您的网站需要吗?找出来,你首先要得到一个什么错误,你的网站是目前生产。如果你有dblog运行你的看门狗表是空的,你可以跳过这一步。如果您的网站是最喜欢的,虽然,有很多的小错误,将填补日志和难以看到问题的升级导致。做一个基线列表:

  • 确保dblog模块启用。
  • 截断的看门狗表清除旧的错误,所以我们才有现在的。(如果你有一个原始的错误日志。要确保备份)
  • 蜘蛛网站管理员打所有的页面,包括行政处。我用wget吧以下这些指示jesstess
    wget --post-data='edit-name=USERNAME&edit-pass=PASSWORD&next=' --save-cookies=cookies.txt --keep-session-cookies http://EXAMPLE.COM/user
    wget -R logout -r --spider --load-cookies=cookies.txt --save-cookies=cookies.txt --keep-session-cookies http://EXAMPLE.COM
    
  • 尝试一些手工的东西,蜘蛛不会打喜欢节省节点或编辑现有的。
  • 把这个剧本到一个文本文件,称为watchdog_distinct.php(你需要在顶部添加一个开放的PHP标签):
    $result = db_query("SELECT DISTINCT message, variables, location FROM {watchdog} WHERE type = 'php' GROUP BY message, variables");
    
    while ($row = db_fetch_object($result)) {
      if (isset($row->message) && isset($row->variables)) {
        if ($row->variables === 'N;') {
          $message = $row->message;
        }
        else {
          $message = t($row->message, unserialize($row->variables));
        }
    
        drush_print($row->location . ' ~ ' . $message);
        drush_print("");
      }
    }
    
  • 运行以下命令通过终端或命令提示符(注:要求下系统安装):
    drush scr watchdog_distinct.php > current_errors.txt

文本文件,current_errors.txt现在将包含一个列表的错误你的网站目前有可以比较的。

升级会发生什么

现在你有一个基准来做比较,它的时间来升级和找出打破。做下面的一个网站开发的复制步骤。

  • (可选)升级到最新版本的核心和贡献。这不是严格的要求,你可以通过升级那些原来需要升级到PHP 5.6的工作。然而,这是一个很好的时间让你的网站完全更新和服务模块的最新版本是最有可能有必要的修复。
  • 适用于已知的补丁,你的模块的使用。见参考文献部分下面的链接到PHP三升级Drupal.org所述问题标签。
  • 设置您的开发网站上运行PHP 5.6。
  • 经过上面的相同过程与截断的看门狗,蜘蛛,和运行脚本,但是给结果的文本文件,一个新的名字。
  • 比较误差在新文本文件中那些老一看这什么破没破之前。
  • 每一个错误,检查补丁或自己写的。确保你做出回馈并标记他们的PHP版本号来帮助其他人找到他们的任何补丁。
  • 重复测试,修补和固定,直到没有新的错误发生。
  • 给你的网站一个很好的手动去点什么蜘蛛错过。

一旦这个过程完成后,没有新的错误显示–恭喜你,你的网站已经准备好处理PHP 5.6!

推荐信

  • Just ran into this blog post last week and an now going through the spidering steps. I found there are a few problems with the step to get a logged in user. First, you're passing the IDs of the input fields, but you should be passing the names. Also, I don't think you need the next parameter, but more importantly, you *do* need to pass the form_id.

    There is very little indication something goes wrong, except that the subsequent spidering will not include the admin section. The complete "login' wget should look something like this:

    wget --post-data='name=USERNAME&pass=PASSWORD&form_id=user_login' --save-cookies=cookies.txt --keep-session-cookies http://EXAMPLE.COM/user

       
       
       
      •  
         
        Avatar

        Hello, thank you, do you know if Ubercart 2 Drupal 6 shops will have problems with php 5.4, php 5.5 or php 5.6 ?

      来自 http://www.mediacurrent.com/blog/getting-your-drupal-6-site-ready-run-php-56

      Updating to PHP 5.6

      The Drop isn't the only thing that is moving; so is PHP. If you have a Drupal 6 site you are most likely running PHP 5.3 or older, versions thatstopped being supported in 2014 or prior. Now that PHP 5.5 has moved out of active support, some hosts, such as Acquia, are dropping support for anything older and sites will be forced to upgrade, ready or not. The good news is that Drupal 6 can be made to work with PHP 5.6, which isactively supported. Drupal 6 core needs just a few patches but many contributed modules will need to be updated and/or patched.

      GET A BASELINE

      So what patches and updates does your site need? To find out, you first want to get a list of what errors your site is producing now. If you have dblog running and your watchdog table is empty, you can skip this step. If your site is like most, though, there are a bunch of little errors that will fill the logs and make it difficult to see what problems the upgrade is causing. To make a baseline list:

      • Make sure the dblog module is enabled.
      • Truncate the watchdog table to clear out old errors so we just have the current ones. (Be sure to keep a backup if you have a need for the original error log.)
      • Spider the site as an admin to hit all of the pages, including the admin section. I used wget for it following these instructions fromjesstess:
        wget --post-data='edit-name=USERNAME&edit-pass=PASSWORD&next=' --save-cookies=cookies.txt --keep-session-cookies http://EXAMPLE.COM/user
        wget -R logout -r --spider --load-cookies=cookies.txt --save-cookies=cookies.txt --keep-session-cookies http://EXAMPLE.COM
        
      • Try out some manual things that the spider won't hit like saving a node or editing an existing one.
      • Put this script into a text file called watchdog_distinct.php (you will need to add an opening php tag at the top):
        $result = db_query("SELECT DISTINCT message, variables, location FROM {watchdog} WHERE type = 'php' GROUP BY message, variables");
        
        while ($row = db_fetch_object($result)) {
          if (isset($row->message) && isset($row->variables)) {
            if ($row->variables === 'N;') {
              $message = $row->message;
            }
            else {
              $message = t($row->message, unserialize($row->variables));
            }
        
            drush_print($row->location . ' ~ ' . $message);
            drush_print("");
          }
        }
        
      • Run the following command via your terminal or command prompt (note: requires the Drush system to be installed):
        drush scr watchdog_distinct.php > current_errors.txt

      The text file, current_errors.txt will now contain a list of the errors your site is currently having that you can compare against.

      UPGRADE AND SEE WHAT BREAKS

      Now that you have a baseline to compare against, it's time to upgrade and find out what breaks. Do the following steps on a development copy of your site.

      • (optional) Upgrade core and contrib to the newest versions. This isn't strictly required and you could get by only upgrading those that turn out to need an upgrade to work with PHP 5.6. However, this is a good time to get your site completely up to date and the newest versions of contrib modules are most likely to have the necessary fixes.
      • Apply known patches to the modules you are using. See the references section below for links to the three PHP upgrade issue tags on drupal.org.
      • Set your development site to run on PHP 5.6.
      • Go through the same process as above with truncating watchdog, spidering, and running the script, but give the results text file a new name.
      • Compare the errors in the new text file to those in the old one to see what is broken that wasn't broken before.
      • For each of the errors, check for patches or write your own. Make sure to contribute back any patches you make and to tag them with the PHP version number to help others find them.
      • Repeat the testing, patching, and fixing until no new errors occur.
      • Give your site a good manual going over to spot anything the spider missed.

      Once this process is completed with no new errors showing – congratulations, your site is now ready to handle PHP 5.6!

      REFERENCES

      • Just ran into this blog post last week and an now going through the spidering steps. I found there are a few problems with the step to get a logged in user. First, you're passing the IDs of the input fields, but you should be passing the names. Also, I don't think you need the next parameter, but more importantly, you *do* need to pass the form_id.

        There is very little indication something goes wrong, except that the subsequent spidering will not include the admin section. The complete "login' wget should look something like this:

        wget --post-data='name=USERNAME&pass=PASSWORD&form_id=user_login' --save-cookies=cookies.txt --keep-session-cookies http://EXAMPLE.COM/user

           
           
           
          •  
             
            Avatar

            Hello, thank you, do you know if Ubercart 2 Drupal 6 shops will have problems with php 5.4, php 5.5 or php 5.6 ?

          来自 http://www.mediacurrent.com/blog/getting-your-drupal-6-site-ready-run-php-56
          普通分类: