<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SURYA NARAYANA MURTHY</title>
    <description>The latest articles on DEV Community by SURYA NARAYANA MURTHY (@suryanarayana).</description>
    <link>https://dev.to/suryanarayana</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F145140%2F0877e1ef-081e-46b6-b58d-372d16211542.png</url>
      <title>DEV Community: SURYA NARAYANA MURTHY</title>
      <link>https://dev.to/suryanarayana</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/suryanarayana"/>
    <language>en</language>
    <item>
      <title>PHP5 to PHP7 code migration steps for the medium or large code base.</title>
      <dc:creator>SURYA NARAYANA MURTHY</dc:creator>
      <pubDate>Thu, 04 Jul 2019 14:22:48 +0000</pubDate>
      <link>https://dev.to/suryanarayana/php5-to-php7-code-migration-steps-for-the-medium-or-large-code-base-52aj</link>
      <guid>https://dev.to/suryanarayana/php5-to-php7-code-migration-steps-for-the-medium-or-large-code-base-52aj</guid>
      <description>&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The original detailed article is posted in &lt;a href="https://www.nalashaa.com/php5-to-php7-migration/"&gt;https://www.nalashaa.com/php5-to-php7-migration/&lt;/a&gt; by me.&lt;/p&gt;

&lt;p&gt;Php 7 has come with really good features in that most important things are &lt;strong&gt;improved in performance, lower memory consumption, many fatal errors converted to exceptions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to upgrade from PHP5 to PHP7:&lt;/strong&gt; &lt;br&gt;
Three main things are there while doing the upgrade. This below process will be helpful if your code base is medium or large.&lt;br&gt;
1) Choosing an IDE (Jet Brains, Net Beans, Eclipse, and Visual Studio Code, etc.).&lt;br&gt;
2) The code upgrade process.&lt;br&gt;
3) Testing phase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Choosing an IDE:&lt;/strong&gt;&lt;br&gt;
While doing an upgrade it is hard to know about all the deprecated and removed functions manually, to solve this issue smart IDE will be helpful.&lt;br&gt;
1) Choose a smart IDE and set the environment to PHP 5.6 in that.&lt;br&gt;
2) Open your entire project in IDE and check for the errors and suggestions given by IDE to refactor the code.&lt;br&gt;
&lt;strong&gt;Note:&lt;/strong&gt; To see the deprecated suggestions from IDE the configurations have to set properly.&lt;br&gt;
3) If possible do refactoring in localhost rather than in development server connected via SSH.&lt;br&gt;
4) Doing it in localhost will help us in saving the development time and also we can keenly monitor the deprecated and removed functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Upgrade Process:&lt;/strong&gt;&lt;br&gt;
Resolve all the errors including notice errors, deprecated errors in PHP 5.6.* then your code will run in PHP 7.0 version.&lt;br&gt;
1) Set error reporting to E_ALL as below. Eg: error_reporting(E_ALL ^ E_STRICT);&lt;br&gt;
2) Solve all the errors including notice errors and deprecated errors.&lt;br&gt;
3) If the codebase is large then just resolve the errors to make it work in PHP 7.0. Then you can re-write your code module by module based on your feasibility.&lt;br&gt;
4) If you are not using mysql_* extension in your old version it would be easy to upgrade otherwise it will take time, based on your code base size.&lt;br&gt;
5) If you are using mysql_* extension to make your work simple try to replace it with mysqli_* so that it will be easy to upgrade. If you have time to upgrade then create an abstraction layer for database operations by using PDO extension because PDO supports multiple databases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing Phase:&lt;/strong&gt;&lt;br&gt;
1) Maintain the logs for database errors, as like you should receive a mail and  that you will get&lt;br&gt;
2) Create the logs for php errors date wise.&lt;br&gt;
3) Create a new testing server i.e. it should be a copy of production server and release it few customers for testing and monitor.&lt;br&gt;
4) If everything is ok you can move it to production.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The original detailed article is posted in &lt;a href="https://www.nalashaa.com/blog/"&gt;https://www.nalashaa.com/blog/&lt;/a&gt; by me.&lt;/p&gt;

</description>
      <category>php7</category>
      <category>migration</category>
      <category>php7upgrade</category>
    </item>
    <item>
      <title>403 forbidden error Django restful request.</title>
      <dc:creator>SURYA NARAYANA MURTHY</dc:creator>
      <pubDate>Thu, 04 Jul 2019 11:41:55 +0000</pubDate>
      <link>https://dev.to/suryanarayana/403-forbidden-error-django-restful-request-2d7j</link>
      <guid>https://dev.to/suryanarayana/403-forbidden-error-django-restful-request-2d7j</guid>
      <description>&lt;p&gt;Add the below statement on top of each and every view function definition (views.py).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@api_view(["POST", "GET"])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;eg:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@api_view(["POST", "GET"])
def GivenInput():
   return Response(e.args[0],status.HTTP_400_BAD_REQUEST)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Note*: I don't know any alternative way to make it global throughout the file.&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>restful</category>
    </item>
  </channel>
</rss>
