Webhosting Blog

Can’t create/write to file ‘/tmp/#sql_50e0_0.MYD’ (Errcode: 17)

While adding a sql statement to a DB sometimes you face an error as follows:

Can’t create/write to file ‘/tmp/#sql_50e0_0.MYD’ (Errcode: 17)

Follow following steps in order to remove the error.

1) Navigate to the document root of the domain.

[root@server ~]# cd /home/username/public_html

2) locate the servers main php.ini

[root@server ~]# php -i | grep php.ini

Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

3) Copy the file /usr/local/lib/php.ini to the public_html folder.

[root@server ~]# cp /usr/local/lib/php.ini  .

4) Open the php.ini file
[root@server ~]#  vi php.ini

Locate the line “session.save_path = /tmp

change it to “session.save_path = /home/username/public_html/tmp

Save and quit the file.

5) Now create the directory/home/username/public_html/tmp

[root@server ~]# mkdir /home/username/public_html/tmp

6) Assign respective ownership

[root@server ~]# chown username.username /home/username/public_html/tmp

7) Assign full permissions to the folder

[root@server ~]# chmod 777 /home/username/public_html/tmp

Now try adding the sql statement to the database. This should remove the error.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s