Changing php.ini with code in a LEMP stack on Debian systems
By doing ad hoc editing like that, you're making certain assumptions about what the php.ini configuration currently looks like.  For example, you have assumed that the size limits end with M, and that those lines are not commented out.  You have also assumed that the cgi.fix_pathinfo line is commented out.

There are two better ways that I prefer.


The simple solution is to put all of the local overrides together in one file.  From the PHP manual:


  Within each directory, PHP will scan all files ending in .ini in alphabetical order.


So, instead of editing, simply create a file with a name like /etc/php/7.0/fpm/zz_overrides.ini containing four lines:

[PHP]
post_max_size = 200M
upload_max_filesize = 200M
cgi.fix_pathinfo = 0


This has the benefit that you leave all of the distro-provided configuration files in their pristine state, and won't need to merge your changes when upgrading.  The disadvantage is that you will need to keep in mind where to look for the effective settings — but that's not hard if you make it a habit.
Alternatively, use augtool, which is a configuration file editor, as in this example.