Can't import database through phpmyadmin

2019-02-15 05:27发布

问题:

When I try upload database (794 kb) I have error:

No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16.

I have read many answer for this error but I can not find and decision and answers that works for me.

My server:

Ubuntu 12.10 Server

Apache/2.2.22 ( apache2-mpm-itk);

MySQL client version: 5.5.27;

phpmyadmin 3.4.11.1deb1;

nginx/1.2.1;

PHP 5.4.6;

Configuration phpmyadmin in /etc/nginx/default

 location /phpmyadmin {

                root /usr/share/phpmyadmin;
                index index.php;

                proxy_pass http://backend/phpmyadmin;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_connect_timeout 120;
                proxy_send_timeout 120;
                proxy_read_timeout 180;

}

php.ini config

file_uploads = On
upload_tmp_dir = /var/tmp
upload_max_filesize = 128M
max_file_uploads = 30
post_max_size = 128M

Thank you!

回答1:

Thanks @denys281, that helped me:

chmod -R 777 /var/lib/phpmyadmin/tmp


回答2:

chown apache-user /var/lib/phpmyadmin/tmp

Replace apache-user with the user configured in /etc/apache2/envvars. Look for these settings:

export APACHE_RUN_USER=apache-user
export APACHE_RUN_GROUP=apache-group

That way you will give permissions for the user running on the web server access to the temp directory, without making it 777 (open to all users).



回答3:

decrease the "upload_max_filesize = 128M" by 1 MB or so . this trick will work



回答4:

In my base php.ini configuration I had disabled file_uploads and limited the upload size so then on for each vhost these values are modified if need be.

PMA uses its own apache configuration which is found at:

/etc/phpmyadmin/apache.conf

So to enable file uploads with a 10Mb file size limit, I edited the file like this:

<Directory /usr/share/phpmyadmin>
    Options SymLinksIfOwnerMatch
    DirectoryIndex index.php

    # Enable File loads if required
    php_admin_flag file_uploads On
    php_admin_flag post_max_size 10M
    php_admin_flag upload_max_filesize 10M

    <IfModule mod_php5.c>
    ...
    </IfModule>
    <IfModule mod_php.c>
    ...
    </IfModule>
</Directory>

Don't forget to reload the Apache server configuration:

Ubuntu < 16.04

service apache2 reload

Ubuntu = 16.04

systemctl reload apache2