Azure app services: Set max_execution_time - azure-web-app-service

I have a php script to import the data into the database. And I would like to import if possible 10000 lines. Except that I'm blocked by the timout because max_execution_time=300 in php.ini
So I did some research and among the solutions I tried the following:
1- <IfModule mod_php7.c> php_value max_execution_time 0 </IfModule> in .htaccess (pulic folder)
2- ini_set('max_execution_time', 0); in my controller (I use Laravel)
3- https://learn.microsoft.com/en-us/azure/app-service/configure-language-php?pivots=platform-windows#customize-phpini-settings
4- I combined all these solutions
None of these ideas work.
Is there anything to check or uncheck in the admin area?
Please, does anyone have an idea of what to do?
Thank in advance

You don't need to modify the php.ini file.
You can modify .htaccess file, add php configuration like below.
Example:
php_value upload_max_filesize 1000M
php_value post_max_size 2000M
php_value memory_limit 3000M
php_value max_execution_time 180
php_value max_input_time 180
Thanks for Wayne Yang's help, for more details, you can refer his answer.
how to config max_execution_time at Azure wordpress on linux web app

Related

ZEND htaccess php_value for special files [duplicate]

This question already has answers here:
Kohana - controller specific .htaccess
(2 answers)
Closed 7 years ago.
Basically I'm not allowed to use PHP's ini_set function to increase upload file size for a formular.
Now I'm trying to change it via htaccess, which works but seems to have the effect that its increased in every controller/form/view.
How am I able to increase the post_max_size in only one special controller/form/view?
When I put the htaccess in the public folder where the index.php from ZEND is, it works, but then it works in every form/controller.
I was trying it with (food is my controller), but this wont work:
<FilesMatch "^(food)">
php_value post_max_size 200MB
</FilesMatch>
Instead of doing that in your main .htaccess file. Put the php vars in an .htaccess file in the same folder as the upload script.
php_value post_max_size 200M
php_value upload_max_filesize 200M
Note: You might need to include the max filesize too because both are needed to increase upload limit.

POST requests are not kept alive

I'm working on a web client that needs to authenticate with a server using NTLM. Since NTLM authenticates the connection I absolutely need to connection to be kept alive to properly do the handshake. I got everything to work with GET requests (for the handshake and the actual request) with the request library but I cannot get it to work with POST requests. Trying to debug the problem using Charles (web proxy) and the only difference I'm seeing between the GET and POST requests is this:
GET:
POST:
As you can see it seems the POST requests are not kept alive. I'm using the 'Connection': 'keep-alive' headers in both cases. Actually the requests are exactly the same except for the method.
Is this a problem with the request library?
Does node automatically close connections for POST requests?
How can I make sure the connection is kept alive?
Try editing the ht access file or if you can the best bait the php.ini file. Edit the required changes such as max time for a POST and max size for a POST. that way I believe your problem can be solved. if you need the changes required let me know.
FYI: If u want to override your php settings without help from ur server support team, these are the 4 methods to do it
Using PHP
ini_set('upload_max_filesize', '100M');
ini_set('post_max_size', '100M');
ini_set('max_input_time', '1500');
ini_set('max_execution_time', '1500');
<input type="hidden" name="max_execution_time" value="2000"/>
<input type="hidden" name="max_input_time" value="2000"/>
<input type="hidden" name="upload_max_filesize" value="105M"/>
<input type="hidden" name="post_max_size" value="105M"/>
Now using the .htaccess
php_value upload_max_filesize "105M"
php_value post_max_size "105M"
php_value max_input_time "1500"
php_value max_execution_time "1500"
#<IfModule mod_php5.c>
#php_value post_max_size 200M
#php_value upload_max_filesize 200M
#php_value memory_limit 300M
#php_value max_execution_time 259200
#php_value max_input_time 259200
#php_value session.gc_maxlifetime 1200
#</IfModule>
Now using htaccess
------NEW php.ini---------
upload_max_filesize = 105M
post_max_size = 105M
max_execution_time = 1500
max_input_time = 1500
--------------/php.ini---------

.htaccess file refuses to load

I'm trying to set my Debian server to look for .htaccess files, but no matter what I do, nothing works!
I have already tried editing my /etc/apache2/sites-available/default file and setting AllowOverride All for my /var/www directory, and also checked if "default" was enabled...
I've also inserted into my apache2.conf file the following:
AccessFileName .htaccess
<Directory "/var/www">
AllowOverride All
</Directory>
For some reason it still doesn't work. This is my .htaccess file (tested to work in XAMPP on Windows)
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200
RewriteEngine off
DefaultType application/x-httpd-php
Options +MultiViews
Maybe you're not hitting the right Directory.
AllowOverride All should do the trick.
When this directive is set to None, then .htaccess files are
completely ignored. In this case, the server will not even attempt to
read .htaccess files in the filesystem.
When this directive is set to All, then any directive which has the
.htaccess Context is allowed in .htaccess files.
The directive-type can be one of the following groupings of
directives.
Don't forget to restart your apache after editing your apache configuration, check your file permission. You can also tail your error log.
Also make sure you have the mod_php module installed as you're using the php_value command

How to set upload file size in htaccess for uploading larger files ?

I have a upload script which allows uploads up to 2 GB. My apache2 server allowed only 8MB of post_max_size. Is there any solution to define such properties from the php.ini in the htaccess. The reason why i want it to get it worked like that? I just want to use such big post_max_size only for my application not for the whole apache2 server.
Any ideas?
You can set the upload_max_filesize property to whatever value you want within either php.ini, .htaccess, or even httpd.conf. If you are using PHP 5.3 above, you can also set this property in user.ini
you can try this in htaccess files:
php_value upload_max_filesize 100M
php_value post_max_size 100M
or you can create php.ini file in root folder of your project put these two lines
upload_max_filesize=100M
post_max_size=100M

Overriding php.ini on server

I have a page which allows users to upload images.
It is returning a 500 error when the user tries to upload larger images though.
The following code...
<?php echo ini_get("upload_max_filesize");
echo ini_get("post_max_size");
echo ini_get("max_input_time");
echo ini_get("max_execution_time");
?>
...returns:
100M
100M
60
3600
I'm guessing from this that it's the max-input-time that's causing the problem as i've tested with files under 100mb but taking longer than 60 seconds to upload.
I don't have access with my host to the php.ini file, so can I override these settings? I've tried adding an htaccess file but I'm not sure I've put it in the correct place.
Put a .htaccess file in the root folder of your website (where your php script is) and add the following values:
php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value max_execution_time 200
php_value max_input_time 200
Of course, you can put other size and time limits. That should work.
Setting up php ini directives depends on the nature of your service provider's configuration. Run a phpinfo() script to look at your configuration. If your provider is starting PHP using suPHP in a user UID context then it may look for a php.ini in the script's directory. This is how it works for my hosting provider.

Resources