<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Migrating from PHP 4 to PHP 5</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="faq.languages.html">PHP and other languages</a></div> <div class="next" style="text-align: right; float: right;"><a href="faq.misc.html">Miscellaneous Questions</a></div> <div class="up"><a href="faq.html">FAQ</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="faq.migration5" class="chapter"> <h1>Migrating from PHP 4 to PHP 5</h1> <p class="para"> This faq section will help you migrate from PHP 4 to PHP 5. </p> <div class="qandaset"><ol class="qandaset_questions"><li><a href="#faq.migration5.php45"> Migrating from PHP 4 to PHP 5 </a></li><li><a href="#faq.migration5.mysql"> Does MySQL work in PHP 5? It seemed to have disappeared. </a></li><li><a href="#faq.migration5.oop"> I hear PHP 5 has an entirely new OOP model, will my existing OOP code work? Where do I find information on these new OOP features? </a></li><li><a href="#faq.migration5.changes"> So besides the new OOP model, what else has changed in PHP 5? Also, is there a PHP 5 specific version of the PHP manual? </a></li></ol></div> <dl class="qandaentry" id="faq.migration5.php45"> <dt><strong> Migrating from PHP 4 to PHP 5 </strong></dt> <dd class="answer"> <p class="para"> Although PHP 5 offers many new features, it's designed to be as compatible with earlier versions of PHP as possible with little functionality being broken in the process. </p> <p class="para"> Be sure to read the appropriate <a href="migration5.html" class="link">PHP 5 migration appendix</a> of this manual as it contains even more information on the topic of migrating to PHP 5. </p> </dd> </dl> <dl class="qandaentry" id="faq.migration5.mysql"> <dt><strong> Does MySQL work in PHP 5? It seemed to have disappeared. </strong></dt> <dd class="answer"> <p class="para"> <a href="ref.mysql.html" class="link">MySQL</a> is supported with the only change being that MySQL support is no longer enabled by <em class="emphasis">default</em> in PHP 5. This essentially means that PHP doesn't include the <strong class="option configure">--with-mysql</strong> option in the <a href="configuration.html" class="link">configure</a> line so that you must now manually do this when compiling PHP. Windows users will edit <var class="filename">php.ini</var> and enable the <var class="filename">php_mysql.dll</var> DLL as in PHP 4 no such DLL existed, it was simply built into your Windows PHP binaries. </p> <p class="para"> Also, the MySQL client libraries are no longer bundled with PHP. More details on this topic are covered in <a href="faq.databases.html#faq.databases.mysql.php5" class="link">the following FAQ</a> and be sure to read the <a href="ref.mysql.html" class="link">MySQL section</a> for details on installing MySQL. An example configure line would be <strong class="option configure">--with-mysql=/usr</strong> while Windows users will need the <var class="filename">libmySQL.dll</var> available to the system. </p> </dd> </dl> <dl class="qandaentry" id="faq.migration5.oop"> <dt><strong> I hear PHP 5 has an entirely new OOP model, will my existing OOP code work? Where do I find information on these new OOP features? </strong></dt> <dd class="answer"> <p class="para"> The main change in PHP 5 is to the OOP model as PHP 5 now uses the <em class="emphasis">Zend Engine 2.0</em>. The <a href="ini.core.html#ini.zend.ze1-compatibility-mode" class="link"> zend.ze1_compatibility_mode</a> directive enables compatability with the <em>Zend Engine 1.0</em> (PHP 4). </p> <p class="para"> The new OOP model is documented in the <a href="language.oop5.html" class="link"> OOP language reference</a> and <a href="migration5.oop.html" class="link">OOP migration appendix</a> sections. </p> </dd> </dl> <dl class="qandaentry" id="faq.migration5.changes"> <dt><strong> So besides the new OOP model, what else has changed in PHP 5? Also, is there a PHP 5 specific version of the PHP manual? </strong></dt> <dd class="answer"> <p class="para"> Few other changes exist, see the <a href="migration5.html" class="link">migration 5 appendix</a> for details. There won't be a PHP 5 specific version of the manual as the bulk of PHP remains the same. </p> </dd> </dl> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="faq.languages.html">PHP and other languages</a></div> <div class="next" style="text-align: right; float: right;"><a href="faq.misc.html">Miscellaneous Questions</a></div> <div class="up"><a href="faq.html">FAQ</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>