0

hi,

i have written a php script for uploading files into linux server. but when i try to run that script i get "UPLOAD_ERR_NO_TMP_DIR ". i even tried to changing upload_tmp_dir directive in php.ini and giving it a path to one of my created folders but it seems nothing is working. can anyone help?

2
Contributors
43
Replies
44
Views
9 Years
Discussion Span
Last Post by nav33n
0

Execute a script with phpinfo function. Check if the path in upload_tmp_dir is valid. Also check if you have given permissions for the temp directory.

0

i have changed the upload_tmp_dir in php.ini to point to a directory created in /usr/local/apache/htdocs/tmp, having owner as nobody and permissions of 0777. altough i hve restarted apache but in phpinfo it is showing upload_tmp_dir as no value

0

Check for "Loaded Configuration File" in phpinfo and change that file. I think you are changing some other php.ini file !

0

i am making changes to file php.ini located in /usr/local/lib. i have compiled apache and php s static module

0

umm.. I have never worked with linux. But you should make changes to that ini file mentioned in "Loaded Configuration File", because its that configuration file that will be used by apache.

0

another php.ini file is present in /etc. even made changes to that anad restarted apache. no success

0

the same apache and php if i run as localhost the scripts work fine, but if run from a remote pc then it gives this error

0

by remote pc i meant running php scripts in my local pc by giving the IP of the remote machine/name of php script in the url

0

How will it execute the script in the local system if you give the IP of a remote machine ? :S

0

all the machines are in network. infact i am running my apache/php in my remote pc.in the url just type
http://IP address/*.php

0

It will run the php file present in the IP address(host) you have specified and not the one which is in your local system.

0

ya i am making changes al the changes in the host system only

0

:S Well, you have 2 php.ini files and have specified the temp directory in both those files. But still when you see phpinfo, temp directory is empty. :) Can you tellme what php.ini file is being used by apache ?

0

:S Well, you have 2 php.ini files and have specified the temp directory in both those files. But still when you see phpinfo, temp directory is empty. :) Can you tellme what php.ini file is being used by apache ?

once your php/apache is running you have twoh php.ini files. one in /etc and another in /usr/local/lib. apache takes into consideration php.ini located in /usr/local/lib. i thnk i hv made things clear:icon_question:

0

I guess you have. But then, why is upload temp directory 'empty' if you have made correct changes to php.ini file ?

0

;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir =
upload_tmp_dir = /tmp

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

***********************************
this is the part of my php.ini file with my changes

0
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = "c:/wamp/tmp"

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

Now that's my php.ini file.Look at the complete path and its within double quotes.

0

i have tried that, nad all different combinations... without much success

0

Files will, by default be stored in the server's default temporary directory, unless another location has been given with the upload_tmp_dir directive in php.ini. The server's default directory can be changed by setting the environment variable TMPDIR in the environment in which PHP runs. Setting it using putenv() from within a PHP script will not work. This environment variable can also be used to make sure that other operations are working on uploaded files, as well.

Source: http://alamo.nmsu.edu/computer/references/php_manual_en.html

0

u mean i sud change my server's defult directory. i dont think you can change the server's default directory from a script because by the time the script is executed the files will alredy be uploaded. is that the soultion...???????????????????

0

No. Just set another environment variable to the temp directory. I have never worked on linux so I dont know how you can set an environment variable in linux, but in windows its pretty simple.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.