20 F
Nashville
Friday, December 6, 2024

How to Install the Apache Web Server on CentOS Stream 9

Apache is available within CentOS's default software repositories, which means you can install it with yum.

How to Create Users in Linux

Linux is a multi-user system, meaning that more than one person can interact with the same system simultaneously.

How to Create Bash Aliases

This tutorial demonstrates how to use the alias command to create personalized shortcuts, which can help you save time and feel less frustrated.

How to change the maximum upload file size

Every time you try and upload a file, do you receive an error claiming that the file exceeds the maximum size allowed? If so, you need to increase the size. 

Run the following command in terminal and look for Loaded Configuration File

php --ini

You need to set the value of the upload_max_filesize and post_max_size directives in your php.ini

upload_max_filesize restricts the maximum size of each individual file
post_max_size limits the total size of all uploaded files in a single request

To upload large files, the post_max_size value must be larger than upload_max_filesize

; Maximum allowed size for uploaded files.
upload_max_filesize = 50M

; Must be greater than or equal to upload_max_filesize
post_max_size = 55M

After modifying the php.ini configuration file, you need to restart your web server to use the new configuration.

Restarting Apache on CentOS Stream 9

systemctl restart httpd

You can create a php info file in order to check the current values. Create the following file phpinfo.php and put the following code inside it:

<?php
phpinfo();
?>

Access this file in your browser (http://yourdomain.com/info.php), and check the updated values. Don’t forget to delete this file after checking for security reasons.

If changes to php.ini are not reflecting in PHP’s phpinfo() check if php-fpm is running by this command:

ps aux | grep php-fpm

php-fpm stands for “FastCGI Process Manager” for PHP and it was probably built in your system. If so, you have to restart it.

For CentOS

systemctl restart php-fpm.service

For more information:

http://www.php.net/manual/en/ini.list.php
http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize
http://www.php.net/manual/en/ini.core.php#ini.post-max-size

Similar Articles

- A word from our sponsors -

Follow Us

Most Popular