DarkRanger Posted April 12, 2011 Share Posted April 12, 2011 Hi, I receive an Error code 1 when I try upload a file. Now I know, from php.net/manual/, that this error is thrown when the file size of the uploaded file exceeds the upload_max_filesize directive specified in php.ini. I went over to Webmin -> Others -> PHP Configuration and specified the max upload size to be 10MB (upload_max_filesize = 10M) and changed, for good measure the post_max_size to 10MB as well. Restarted the server and retried uploading a 2.5MB file, and it still throws an error 1. Am I missing something? Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 12, 2011 Share Posted April 12, 2011 What is the actual syntax you used in the settings, because 10MB is invalid and causes a 10 byte size limit. 10M should work. What does a phpinfo() statement show for the two settings you tried to change? Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200472 Share on other sites More sharing options...
DarkRanger Posted April 12, 2011 Author Share Posted April 12, 2011 Actual syntax is 10M. I cant access phpinfo() now because our webserver is off for some or other reason... Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200498 Share on other sites More sharing options...
DarkRanger Posted April 12, 2011 Author Share Posted April 12, 2011 Okay, under phpinfo() it says local and master values are 2M. Really don't know why. I have them set to 10M in 3 locations: /etc/php5/cgi/php.ini ; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 10M /etc/php5/cli/php.ini ; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 10M /etc/php5/apache/php.ini ; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 10M Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200519 Share on other sites More sharing options...
PFMaBiSmAd Posted April 12, 2011 Share Posted April 12, 2011 When you browse to a file containing a phpinfo() statement, the Loaded Configuration File value is the one that the web server/php is using. Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200524 Share on other sites More sharing options...
DarkRanger Posted April 12, 2011 Author Share Posted April 12, 2011 Where can i find / edit this file? Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200529 Share on other sites More sharing options...
PFMaBiSmAd Posted April 12, 2011 Share Posted April 12, 2011 What 'this file' are referring to? Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200539 Share on other sites More sharing options...
DarkRanger Posted April 12, 2011 Author Share Posted April 12, 2011 Nevermind. Misread your post. I went throught the phpinfo() page and it loads the right ini file: Loaded Configuration File /etc/php5/apache2/php.ini But only give a 2M limit on uploads. Any idea about fixing this? Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200541 Share on other sites More sharing options...
PFMaBiSmAd Posted April 12, 2011 Share Posted April 12, 2011 The only time I have seen it where the correct php.ini is being used and the syntax of the statement is correct (and you have restarted the web server to get any changes made to the master php.ini to take effect, assuming that is the master php.ini and not a local one) but a setting doesn't work is if there is a syntax error earlier in the php.ini file. Do any changes you make to that php.ini show up in the phpinfo() output? Try putting a setting right at the start of the php.ini to see if it takes effect. Any chance you have edited the php.ini using a Windows program and it got renamed as php.ini.txt? Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200555 Share on other sites More sharing options...
DarkRanger Posted April 12, 2011 Author Share Posted April 12, 2011 No, it's still php.ini. Also, if I put the upload_max_filesize=9M right at the top, nothing changes. Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200559 Share on other sites More sharing options...
PFMaBiSmAd Posted April 12, 2011 Share Posted April 12, 2011 Could be a permission problem. Perhaps the php.ini file is owned by a different user than the web server is running under and the permissions are not set so that the web server/php can read the file. Are they are relevant messages in the web server error log file? Where is this server at? Perhaps the web host knows something as to why the php.ini cannot be read. In the mean time, you can also put those settings in to a .htaccess file (when php is running as an Apache Module and the web server has been configured to allow settings to be changed in a .htaccess file) or in a local php.ini (when php is running as a GCI application.) Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200564 Share on other sites More sharing options...
DarkRanger Posted April 12, 2011 Author Share Posted April 12, 2011 It's a VPS. So the web host has no responsibility on that server and i set it up. http://www.vceza.com/phpinfo.php that's the link to the phpinfo() if you want to have a look at it. Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200566 Share on other sites More sharing options...
DarkRanger Posted April 13, 2011 Author Share Posted April 13, 2011 Anyone?? Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1200998 Share on other sites More sharing options...
DarkRanger Posted April 13, 2011 Author Share Posted April 13, 2011 OMW... I should really rather use putty than webmin... I found my mistake. The php.ini file loaded was in the apache2 folder. Webmin kept loading the apache php.ini file so it never changed. It reflects what i want it to reflect now so it's good. PFfft, that'll teach me. Quote Link to comment https://forums.phpfreaks.com/topic/233458-file-uploading/#findComment-1201129 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.