Changes in file "php.ini" doesn't have any effect

I need to upload file more than 100 MB, yii\web\UploadedFile. I am using Linux, CentOS 7.

I did:

  1. check path to php.ini in phpinfo()
  2. add in php_value upload_max_filesize 512M php_value post_max_size 512M in php.ini
  3. restart the LAMP server (lampp) and run phpnfo() to check, but nothing changed. Although php.ini changed.
  4. restart my PC and start the LAMP server, but still no changes in phpnfo().

I have found some solution to add additional.ini.files, but in my phpinfo(): Scan this directory for additional .ini files (none).

I solve this by adding this in file .htaccess:

php_value upload_max_filesize 512M

php_value post_max_size 512M

But the problem still exists. I can't influence file php.ini.

Upvotes: 1

Views: 202

Answers (1)

maatien
maatien

Reputation: 61

The syntax php_value ... only works in .htaccess files.

To change the value in the php.ini file, you dont' need the php_value part. Search the file for the upload_max_filesize attribute, it's most likely already there and change the value to 512M. If the line starts with a ; remove it as this comments the line. Do the same for the post_max_size attribute. If these attributes does not exists yet, add them to the end of the file:

upload_max_filesize = 512M
post_max_size = 512M

After editing the file you need to restart PHP and Apache.

Upvotes: 1

Related Questions