Skip to main content
Known Participant
Dec 18, 2020 12:31 PM UTC
Question

update my old php code

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

    This topic is closed to new replies. Start a new post to keep the conversation going.

    2 replies

    Nancy OShea
    Community Expert
    Community Expert
    Dec 18, 2020 10:54 PM UTC

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

     

    Translate
    Nancy O'Shea— Product User & Community Expert
    Legend
    Dec 18, 2020 1:57 PM UTC

    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.

    Translate