azure linux php,Azure App Service Linux - Update PHP Settings

Azure App Service Linux - Update PHP Settings

01/29/2019

2 分钟可看完

本文内容

Azure App Service Linux provides PHP images with preconfigured settings and extensions.  If you need to adjust your PHP settings, follow the steps provided below.

Updating PHP Settings-

Settings such as upload_max_filesize, expose_php, and others can be modified using a custom "ini" file. You can use either SSH or Bash to accomplish this.

Select Bash or SSH from the top menu.

In Bash/SSH, go to your "/home/site" directory.

Create a directory called "ini" (i.e. mkdir ini)

Change directories to "ini".

We'll need to create an "ini" file to add our settings to. In this example, I'm using "extensions.ini". There are no file editors such as Vi, Vim, or Nano so we'll simply use echo to add the settings to the file. I'm changing the "upload_max_filesize" from 2M to 50M. Below is the command that I used to add the setting and create an "extensions.ini" file if one doesn't already exist.

NOTE: If you already have an extensions.ini file, you can use the same command which will add the new setting to the file.

/home/site/ini>echo "upload_max_filesize=50M" >> extensions.ini

/home/site/ini>cat extensions.ini

upload_max_filesize=50M

/home/site/ini>

If using SSH, you can use vi to create/edit the extensions file using the following commands.

a) vi extensions.ini

b) Press "i" on your keyboard to start editing and add the following.

upload_max_filesize=50M

c) Press "Esc", then ":wq!" and enter to save.

Add an Application Setting-

We'll now need to go to the Azure Portal and add an Application Setting to scan the "ini" directory that we just created to apply the change for upload_max_filesize.

Go to the Azure Portal (https://portal.azure.com) and select your App Service Linux PHP application.

Select Application Settings for the app.

Under the Application settings section, press the "+ Add new setting".

For the App Setting Name, enter "PHP_INI_SCAN_DIR".

For the value, enter "/usr/local/etc/php/conf.d:/home/site/ini"

NOTE: If you're you've recompiled a PHP extension such as GD, perform the steps at "Recompiling PHP Extensions" at Azure App Service - Adding PHP Extensions and enter a value of "/home/site/ini" and omit the "/usr/local/etc/php/conf.d:" portion.

The first portion of the value is the location of other ini files that come with the Docker container and the second part (after the ":") is the directory that contains our new ini file.

Press the save button.

Testing-

1. You should now see the upload_max_filesize increase from 2M to 50M if you have a PHP info page. If not, create one by going to your /home/site/wwwroot directory and perform the following.

echo "<?php phpinfo();" >> info.php

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值