Skip to main content
Known Participant
December 18, 2020
質問

update my old php code

  • December 18, 2020
  • 返信数 2.
  • 218 ビュー

Hello,

 

I have an old site build on PHP 5.6 I Want to upgrade to a new server with php 7

 

I it enough to change the connection code?

This is my cnnection code
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_Mastercar = "**";
$database_Mastercar = "**";
$username_Mastercar = "**";
$password_Mastercar = "**";
$Mastercar = mysql_pconnect($hostname_Mastercar, $username_Mastercar, $password_Mastercar) or trigger_error(mysql_error(),E_USER_ERROR);
?>

Thank in advance

    このトピックへの返信は締め切られました。

    返信数 2

    Nancy OShea
    Community Expert
    Community Expert
    December 18, 2020

    Manually recode in PHP 7x or get commercial extensions to help you re-build the application from ground up.

     

    Nancy O'Shea— Product User & Community Expert
    Legend
    December 18, 2020

    NO, its NOT enough just to change the database connection code, you have to change the queries to the database as well. I'd stick to 5.6 for now, unless you want to undertake a complete connection/querying rewrite.

     

    No website being created today should use mysql instead use either mysqli(improved) or PDO. Old websites which use mysql, which is NOT compatible with php versions 5.6+ the connection and querying needs to be completely revised or kept on life support until the time comes to update.