WordPress upload file size error even after raising php limits

NOTE: You MUST reboot your server or reload your web server (Apache or Nginx) to ensure the changes take effect after each step.

You can first try to add the following to your theme’s functions.php file. If it does not work, then remove it. If it does, I recommend you create a child theme so the code will remain active even after file changes during theme updates.

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

Second, you can try adding a php.ini file with the following contents to the root of the directory where your wordpress installation is. It is possible that WordPress is not reading from the php.ini file located at the php directory.

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

The final thing you could try, if you want to change to apache web server rather than nginx is add the following to your .htaccess file

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

EDIT:
You can attempt to add this to your wp-config.php file at the end:

define('WP_MEMORY_LIMIT', '64M');

/* That's all, stop editing! Happy blogging. */

Now do step one once more. Then clear your browser cache and try again.