1

Whenever I try to upload a file to import into phpMyAdmin I get the following error:

File could not be read

phpMyAdmin is the only php script I am running on my server, and as such my php configuration file is fairly vanilla except for the following changes:

upload_tmp_dir = /tmp upload_max_filesize = 10M post_max_size = 50M memory_limit = 64M 

The file I am trying to import is 4MB, well within the 10MB upload size and 50MB post size (it is also UTF-8). Setting upload_tmp_dir actually fixed a previous problem I was having (where phpMyAdmin was complaining that I didn't even specify a file) or at least made the error change to what I am getting now. The permissions on /tmp are 777.

What could the problem be? The file comes from a cpanel installation at hostmonster I am migrating away from onto my own vps. I have tried getting the sql file from the cpanel backup utility and from their installation of phpMyAdmin (both uncompressed and gzipped). I do not believe that the files are corrupted.

Extra information: I am running CentOS 5.6, phpMyAdmin 3.4.2, mysql 5.1.52, and php 5.2.16.

2
  • Are the web server error logs showing anything that could give you more of a clue as to what is going on? Commented Jun 10, 2011 at 12:59
  • Just to make sure I set the log to a new file and tried the upload. The only entries in the new file pertain to my self signed ssl certificate. The SSL is actually something I added in after I was already getting this error. Commented Jun 10, 2011 at 13:22

3 Answers 3

2

If open_basedir is set in your php.ini PHP will not be able access files above that directory.

1
  • Aha! I had open_basedir set to /var/www/vhosts. I changed it to /var/www and set up a temp directory there. Commented Jun 10, 2011 at 17:30
1

I think the problem is setting of php.ini:

upload_tmp_dir = /tmp open_basedir = /data/home/:/tmp/ 

The open_basedir needs add the /tmp/ too

1

I think you can setup this in the configuration file php.ini:

upload_tmp_dir = /tmp open_basedir = /var/www:/data/home:/tmp 

But, don't add the last slash of the targeted directories. Founded in the php documentation :

When you want to restrict access to only the specified directory, end with a slash. For example: open_basedir = /dir/incl/ 

http://php.net/manual/en/ini.core.php

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.