1

I am running Ubuntu Server 20.04 LTS VM. This VM is running to run and manage LAMP stack + SFTP access to manage website files. Apache2 seems to work properly, but PHP 7.4 does not apply ".user.ini" settings.

We created ".user.ini" file inside "/var/www/html" path (default Apache2 path in Ubuntu). Permission are setted properly, but Apache2 does not load settings inside this file.

All files and folder are owned by webdev:www-data (webdev is a custom user that permit us to access to Linux VM using SFTP). Chmod is 775 for this file in this moment. I am not running any custom virtual host, so I am using 000-default.conf settings in

/etc/apache2/site-enabled/000-default.conf

Apache2 continue to apply PHP.ini settings.

Can someone help me? Thanks a lot! Federico

  • `PHP includes support for configuration INI files on a per-directory basis. These files are processed only by the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner extension. If you are running PHP as Apache module, use .htaccess files for the same effect.` - https://www.php.net/manual/en/configuration.file.per-user.php – aynber Apr 28 '22 at 17:42
  • How can i check if I am running PHP as module or not? Should I specify something in my 000-default.conf file? I did not found any info about it. – Federico Coppola Apr 28 '22 at 17:59
  • https://stackoverflow.com/questions/16414054/find-out-how-php-is-running-on-server-cgi-or-fastcgi-or-mod-php has some information on that – aynber Apr 28 '22 at 18:08

1 Answers1

0

I solved the issue in this way:

If you need to use ".user.ini" settings you must use CGI/FastCGI You can see if you are using Server API (for PHP) via CGI/FastCGI or Apache2 Module using "phpinfo()" In my case Server API was Apache2 Handler (it is not fine for .user.ini)

I disabled PHP as Apache2 module. You can do it a2dismod phpX.X (in my case php7.4) Later I installed php-fpm apt install php7.4-fpm and I checked if it is running service php7.4-fpm status.

Finally I created ".user.ini" file and I rebooted Apache2 server.

Now all it is working properly

Thanks a lot @aynber :)