/    Sign up×
Community /Pin to ProfileBookmark

I updated my the PHP.ini in Windows folder that it can accepts larger uploaded file size, it workd fine on my local machine, how can i configure it on the server?!

to post a comment
PHP

23 Comments(s)

Copy linkTweet thisAlerts:
@GenixdeaeNov 12.2005 — same way you did with your local machine, unless you're server is being hosted by someone and somewhere where you can't get to then the only option is to contact the provider and ask them if/how you can change it
Copy linkTweet thisAlerts:
@JickNov 12.2005 — Your hosting company would have to allow access to the php.ini file. Most hosting companies do not. I believe through PHP you can manipulate some settings which reside in the php.ini file; but not all. I believe you might find [URL=http://us3.php.net/manual/en/function.ini-set.php]this document[/URL] useful if you want to attempt the way I'm referring to.
Copy linkTweet thisAlerts:
@NogDogNov 12.2005 — Looks like if your PHP version is 4.2.3 or older, you can modify in the script with the ini_set() function. On any newer version, only by modification of php.ini, .htaccess, or httpd.conf.
Copy linkTweet thisAlerts:
@CipherauthorNov 12.2005 — well is that correct syntax?!
[code=php]ini_set("post_max_size", "75M");
ini_set("upload_max_filesize", "25M");
ini_set("max_execution_time", "90");[/code]

and if i changed that in my page, will it change the ini once the page is executed?!
Copy linkTweet thisAlerts:
@CipherauthorNov 12.2005 — i tried this code in the page which uploads the file but it didnt work.
Copy linkTweet thisAlerts:
@CipherauthorNov 12.2005 — if i used FTP to connect to server from PHP, will that solve the problem of upload file size, or same problem?!
Copy linkTweet thisAlerts:
@bokehNov 12.2005 — Looks like if your PHP version is 4.2.3 or older, you can modify in the script with the ini_set() function. On any newer version, only by modification of php.ini, .htaccess, or httpd.conf.[/QUOTE]well is that correct syntax?!
[code=php]ini_set("post_max_size", "75M");
ini_set("upload_max_filesize", "25M");
ini_set("max_execution_time", "90");[/code]

and if i changed that in my page, will it change the ini once the page is executed?![/QUOTE]


I'm not sure why it may be different before 4.2.3 but here is my take on it... [B]ini_set[/B] just cannot be used to reset this value. The simple reason is the timeline. First the request along with the post data is sent to the server and is handled as per defaults stored in php.ini or modifications contained in .htaccess. Once the data has arrived at the server if it doesn't comply with the settings of these two files it is deleted. Then and only then does the script start to run. As can be deduced from this even if your script contains [B]ini_set[/B] that cannot be used to change things that have already happened.

If you are on a shared server and can make changes in .htaccess that are specific to your virtual server, you could use something like the following:
[code=html]php_admin_value post_max_size 75M
php_admin_value upload_max_filesize 25M [/code]
Copy linkTweet thisAlerts:
@NogDogNov 12.2005 — I'm not sure why it may be different before 4.2.3 ...[/QUOTE]
As per http://www.php.net/manual/en/ini.php#ini.list :
<i>
</i>+---------------------+---------+----------------+------------------------------+
| Name | Default | Changeable | Changelog |
+---------------------+---------+----------------+------------------------------+
| upload_max_filesize | "2M" | PHP_INI_PERDIR | PHP_INI_ALL in PHP &lt;= 4.2.3. |
+---------------------+---------+----------------+------------------------------+
Copy linkTweet thisAlerts:
@bokehNov 12.2005 — I wasn't suggesting you were wrong, it's just that I don't understand why. Either:

1) my argument is flawed,

2) the timeline was altered

3) this was altered because it was considered a security loophole.

4) something else
Copy linkTweet thisAlerts:
@CipherauthorNov 13.2005 — Well i tried all ways and nothing working, i found .htaccess on the server, so i downloaded it and here's how it looked

[COLOR=Navy]# -FrontPage-



IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*



<Limit GET POST>

order deny,allow

deny from all

allow from all

</Limit>

<Limit PUT DELETE>

order deny,allow

deny from all

</Limit>

AuthName www.islam-christianity.org

AuthUserFile /home/galeb/public_html/_vti_pvt/service.pwd

AuthGroupFile /home/galeb/public_html/_
vti_pvt/service.grp[/COLOR]


when i updated it and uploaded it, it didnt want to open the site, and gave error in configuration.

so here's my website when i connect to it through cPanel page and FTP, any other idea?!

[upl-file uuid=803e09cf-99d5-4024-9020-28733158f8b2 size=42kB]cPanel.jpg[/upl-file]

[upl-file uuid=9057e299-0614-4ec2-a9eb-eecfcbf99d5c size=36kB]Ftp.jpg[/upl-file]
Copy linkTweet thisAlerts:
@bokehNov 13.2005 — Is this how it looked after you edited it?[code=html]php_admin_value post_max_size 75M
php_admin_value upload_max_filesize 25M
# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.islam-christianity.org
AuthUserFile /home/galeb/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/galeb/public_html/_vti_pvt/service.grp[/code]
Copy linkTweet thisAlerts:
@CipherauthorNov 13.2005 — yes, and here's the error.

[I]The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email][email protected][/email] and inform them of the time the error occurred, and anything you might have done that may have caused the error.



More information about this error may be available in the server error log.





Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. [/I]
Copy linkTweet thisAlerts:
@ScleppelNov 13.2005 — It should be php_value instead of php_admin_value, php_admin_value can not be used in .htaccess files.
Copy linkTweet thisAlerts:
@bokehNov 13.2005 — Scleppel is right. I guessed it was php_admin_value as I use this in httpd.conf for virtual hosts. For more info check the manual. [URL=http://es2.php.net/configuration.changes]How to change configuration settings.[/URL]
Copy linkTweet thisAlerts:
@CipherauthorNov 14.2005 — well i created httpd.conf and i added this commands and it worked without errors but didnt have any affect
[code=php]ini_set("post_max_size", "75M");
ini_set("upload_max_filesize", "25M");
ini_set("max_execution_time", "90"); [/code]


where can i set these commands: "AllowOverride Options", "AllowOverride All" ?!
Copy linkTweet thisAlerts:
@bokehNov 14.2005 — You can't just create a httpd.conf file; it's the server's main configuration file.

Go back to .htaccess and add these three lines:
[code=html]php_value post_max_size 75M
php_value upload_max_filesize 25M
php_value max_execution_time 90
[/code]
Copy linkTweet thisAlerts:
@CipherauthorNov 14.2005 — [URL=http://www.webdeveloper.com/forum/showpost.php?p=463518&postcount=11]http://www.webdeveloper.com/forum/showpost.php?p=463518&postcount=11[/URL]

well didnt you see that post, that's after i added these lines in the place you told me to.
Copy linkTweet thisAlerts:
@bokehNov 14.2005 — [URL=http://www.webdeveloper.com/forum/showpost.php?p=463518&postcount=11]http://www.webdeveloper.com/forum/showpost.php?p=463518&postcount=11[/URL]

well didnt you see that post, that's after i added these lines in the place you told me to.[/QUOTE]
And didn't you see that they are not the same lines?
Copy linkTweet thisAlerts:
@CipherauthorNov 14.2005 — Yes i changed it and it's the same error
Copy linkTweet thisAlerts:
@bokehNov 14.2005 — I just tested this. I put the following in .htaccess: [code=html]php_value post_max_size 75M
php_value upload_max_filesize 25M
php_value max_execution_time 90[/code]
I then ran a script with the following contents:[code=php]<?php
print ini_get('post_max_size').
' - '.ini_get('upload_max_filesize').
' - '.ini_get('max_execution_time');
?>[/code]
and it prints:[code=html]75M - 25M - 90[/code]If that is not the result you are getting then you have an error elsewhere.
Copy linkTweet thisAlerts:
@CipherauthorNov 15.2005 — where exactly did you do that, on server or on your local machine, coz when i tried that on my pc, it gave me same original values, when i tried it on server, it gave me same error.

When i tried to do this in the php page where i upload files
[code=php]ini_set ("post_max_size", "20M");
ini_set ("upload_max_filesize", "25M");
ini_set ("max_execution_time", "90");[/code]

and then used ini_get

i found that it changed only the max_execution_time, and didnt change other, any more ideas please
Copy linkTweet thisAlerts:
@bokehNov 15.2005 — I did it on my server:
[code=html]Apache 2.0.54
PHP 5.0.4[/code]
Copy linkTweet thisAlerts:
@bokehNov 15.2005 — [code=php]ini_set ("post_max_size", "20M");
ini_set ("upload_max_filesize", "25M");
ini_set ("max_execution_time", "90");[/code]
[/QUOTE]
As stated previously that does not work after PHP 4.23
×

Success!

Help @Cipher spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...