php file upload not working on server

Published: 24 September 2022
on channel: linux-syr
3,820
35

check if php is installed:
php -v
if not:
sudo apt-get install php8.1
or : sudo apt-get install php8.1*
or: sudo apt-get install -y php8.1-cli php8.1-common php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml php8.1-bcmath

Locate the php.ini file and make sure that file_upload is enabled and not commented.

sudo find / -name php.ini

edit:
sudo nano /etc/php/8.x or 7.4 your version/apache2/php.ini
uncomment:
file_upload=no
file_max_filesize=100M
max_file_uploads= 200

Make sure your php file upload script contains the correct upload folder directory:

./upload/ or /upload , upload/

Check if the upload folder has the required permission:
""normally all files on a server must have the following permission: 644 and all folders 755""
sudo chmod 755 -R your-upload-folder
if not. try with chmod 777

sudo chown username:usergroup your-upload-folder

restart your server.
apache:
sudo service apache2 restart

nginx:
sudo systemctl restart nginx


Watch video php file upload not working on server online without registration, duration hours minute second in high quality. This video was added by user linux-syr 24 September 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 3,82 once and liked it 3 people.