Setting PHP.ini Config In Azure App Service PHP 8.1 / NGINX
Following on from my previous post showing how to configure PHP 8.1-based NGINX Azure App Services, another common requirement is updating php.ini settings — things like increasing the max upload file size or setting a timezone.
With Apache you'd use .htaccess. With NGINX on App Service, that's not an option. Instead, you deploy a custom php.ini via a startup script.
Default Location
The default PHP ini file lives at:
/usr/local/etc/php/conf.d/php.ini

Steps
1. Copy the default php.ini into persistent storage
App Service's /home directory persists across restarts. Copy the default ini there so you can edit it:
cp /usr/local/etc/php/conf.d/php.ini /home/startup/php-ini/php.ini
2. Customise your settings
Edit /home/startup/php-ini/php.ini with whatever overrides you need, for example:
date.timezone = "Europe/London"
upload_max_filesize = 256M
post_max_size = 256M
3. Add to your startup script
In startup.sh, copy your custom ini into place and reload NGINX:
cp /home/startup/php-ini/php.ini /usr/local/etc/php/conf.d/php.ini
service nginx reload
Important: NGINX body size
If you're increasing upload_max_filesize, make sure your NGINX config also allows large request bodies. Add this inside the http or server block:
client_max_body_size 256M;
If NGINX rejects the request before PHP even sees it, your PHP ini changes won't help.
See also: Azure AppService PHP 8.1 & NGINX With WordPress for the full NGINX configuration.