Justfindit.se Magazine

    About      Contact      Give us a tip    
    The World      Lifestyle      Technology      TV Media Journalism      Science      Cocktails & Wine      Internet      Economy/Business      Cities      Travel      Reportage      Books      Websites      Interview      True story    
 
Written by: IT Team on November 9, 2018.

Updating PHP from 5.6 to 7.2

Updating PHP from 5.6 to 7.2. Here below you can see some known details that can cause problems when you change to PHP 7.2 from some older version like 5.6. As soon as people hear words like change or update when talking about versions of their programming languages, programs and other systems or parts of it they get worried. People feel panic. What if something goes wrong? What if their website stops working?

CMS and websites

Many people use different CMS tools for their websites. A very common CMS is WordPress. This one can manage its own updates. The whole system, themes and plugins can be updated very easy. So, changing PHP from 5.6 to 7.2 is not noticeable if all updates have been done regularly.

Programming and websites

If your website has been created by some programmer some years ago then it can be problem. Without updates maybe your website uses too old PHP. In this case you will probably have to do something. Here below you can see some known details that can cause problems when you change to PHP 7.2 from some older version like 5.6. Updating PHP from 5.6 to 7.2:
Problem: If we have $$var in a FOR-loop, the variable and its content does not work anymore outside the FOR-loop. Solution: It works as this instead: ${$var} in PHP 7.2 Problem: Empty line above <?php gives not working website Solution: Avoid that empty line. Problem: Database connection stops working because MySQL functions are not in use anymore Solution: Use PDO_Mysql queries instead of MySQL queries
  Updating PHP from 5.6 to 7.2 Updating PHP from 5.6 to 7.2: If programming was done properly from the beginning all changes can be done easily.   One of  the biggest problem in this case is when a website that uses old database connection stops working. In that case it can take long time to make changes if there are many scripts in many files.
Old database connection can look like this: $connection = mysql_connect($db_conn["host"],$db_conn["login"],$db_conn["paswd"]) or die ("No connection to the database!"); mysql_select_db($db_conn["name"], $connection);   New database connection looks like this: $db = new PDO('mysql:host=domain.com.mysql;dbname=domain_com;', 'domain_com', 'databasePassword');
  If programming was done properly from the beginning all changes can be done easily. So whenever you program a website, it can be good to organize files and scripts properly. It is good for your future changes and improvements.  


Back to the to previous page


  ® All Rights reserved Justfindit.se Magazine 2014.