How to support upload on PHP installed with IIS 7.0? - php

I install PHP on IIS 7.0 at Windows Server 2008 and Windows 7. I have setup Wordpress and Joomla and config finished.
But I find I can not upload any file with PHP program but okay under ASP.NET.
I had,
Config the every permission with write of Upload folder to IUSR and IIS_USRS
Config the PHP.ini with file_uploads = On
Setup a temp directory and config for every permission with write. upload_tmp_dir = "E:\Webware\PHP.Upload.Tmp"
Reboot IIS
But I still can not upload file via PHP program.

When you run phpinfo() what is the value of your upload_tmp_dir?
I'd wager your upload_tmp_dir variable in the [PHP] configuration section of php.ini file is being overwritten in the [WebPIChanges] configuration section, towards the end of your php.ini file...
Depending on how you installed PHP, there may be two upload_tmp_dir variables in your php.ini file, and if the the second one is set, it will overwrite the first.

Take a look at this site, it may help you: http://www.radinks.com/upload/config.php
Also i suggest you to don't modify upload_temp_dir

Related

PHP - overwrite mapping for ini file on IIS 8.5

I am going to change my website PHP version from 5.2 to 7.2, I have synced all of setting from php.ini in 5.2 version to the new one, but when running the phpinfo.php file on the server, most of the variables have no value. especially session.save_path and error_log, however, I have set all of them in the php.ini file. also display errors is on.
session.save_path = C:\PHPSessions
error_log = "C:\PHPSessions\php-7.2.10_errors.log"
I have checked for permissions as well, IUSER,IIS_IUSRS,users,admin all have full control.
now my website not loading, and it's my info file:
ps: I have changed the php version on my local using wamp, and there wasn't such problem, so the code is fine.

How to change the default xampp php.ini directory

The php.ini file in xampp is located here: C:\Windows for php.ini
The phpinfo contains this information:
Configuration File (php.ini) Path C:\WINDOWS
Loaded Configuration File (none)
Scan this dir for additional .ini files (none)
How can i change the directory?
open this file
"\xampp\apache\conf\extra\httpd-xampp.conf"
find this block
PHPINIDir "C:/xampp/php"
change the directory
From my experience using XAMPP, it's better to put the php.ini file where XAMPP expects it to be by default. Typically XAMPP is going to look under its own dir. For Windows, it would look like, or similar to, this: [yourdrive_letter]:\xampp\php\php.ini . That's what should be showing up in your Loaded Configuration File setting. I always ignore whatever it says in Configuration File (php.ini) Path, because that's not really the ini that xampp is using.
Go look under your xampp directory and find the "php" folder. If it's not there, then it needs to be (unless you've somehow configured xampp to look elsewhere). So find the PHP folder you want to use and put it under the xampp folder. The version of xampp I have does not allow for switching php versions/folders "on the fly", so the folder MUST BE named "php". (Yeah, I've tried having two php folders with different names and just swapping them out -- that doesn't work well in xampp).
I don't see where I was telling you to edit anything under the Windows directory. If you can't copy the php.ini for some reason, then you can use the template for it provided by XAMPP and change it to your needs. You asked how to change the directory for your php.ini and your subject was about XAMPP so I assumed you have an XAMPP directory somewhere and knew how to configure it -- my bad. Most installation directions I've seen for XAMPP tell you to put it in C:\xampp. If you have it under a Windows directory, then you have my sympathy. If you DO have a C:\XAMPP, I'm simply saying to find a directory called PHP under THAT folder, and then configure your XAMPP to use the php.ini under C:\xampp\php. Under your 'config' option for Apache, you should see a file option called 'httpd-xampp.conf'. Select that to edit it; there should be a module called <IfModule php5_module> in there. Under that is your PHPINIDir directive. Change whatever path it's pointing at to "C:/xampp/php". Add the closing tag (</IfModule>). Restart Apache. (You may have to stop Apache before editing this file). If your XAMPP is in your Documents directory for some reason, then it's just a matter of changing the paths in this answer. I wouldn't put it there personally, but it seems your network people have you kind of locked down. Sorry if my previous answer was unhelpful.

Editing php.ini with MAMP 3.5 where is the right ini file?

I'm trying to edit my php.ini file to turn off short tags. Pretty standard.
phpinfo() tells me I am running PHP Version 5.6.10
I have edited 2 php.ini files so far, and neither has taken effect (yes, I restarted MAMP)
MAMP/conf/php5.6.10/php.ini
MAMP/bin/php/php5.6.10/conf/php.ini
Neither file changes the status of short tags
Can anyone direct me where/how to change my php.ini settings?
I really freaking miss WAMP. Whose bright idea was it to buy a Mac?!?
When you run phpinfo() you need to look for the value Loaded Configuration File. This tells you which php.ini file PHP is using in the context of the web server.
Aaannnnnnnnddddd I was being a dufus
I had been commenting the line out instead of changing to "Off"
as you version is 5.6.10, and supposed your apache2 server runing on ubuntu.
php.ini dir is
/etc/php5/apache2/php.ini
On my Mac, running MAMP I have a few locations that would contain the likely php.ini
So I edited the memory_limit to different values in the 2 suspected files,
to test which one effected the actual MAMP PHP INFO page details.
By doing that I was able to determine that this was the correct php.ini:
/Applications/MAMP/bin/php/php7.2.10/conf/php.ini

Joomla 3.2 Increase the upload_max_filesiz

I am trying to download this template on Joomla 3.2 extension manger :
http://scriptmafia.org/templates/115622-yt-moustache-yootheme-for-joomla-25-32.html
but every time I upload it, it gives me this error:
There was an error uploading this file to the server.
I have read articles about "increase the upload max size in the php.ini file".
I have tried to find this file in the administrator files section in Joomla, but it is "not found".
So how can I fix this problem? It has not happened for this template only, it has happened for several. So I am almost sure it is due to the upload size.
Edit your php.ini and increase *upload_max_filesize* and *post_max_size*; then restart your web server.
If you don't know where is your php.ini, create a php file to discover: echo php_ini_loaded_file();
The returned path is where your php.ini is located.
EDIT
Well, seems like you have a permission error and not size limit. Try to change permissions of the temp Joomla folder (you can see/configure it on Global Configuration > System).
If you are using XAMPP , php.ini file will be located in c:\XAMPP\php folder. Find the file and increase file upload size there.
If you are using WAMP, You can find ini file in /wamp/bin/php directory.
The location may vary from one OS to another.
You can follow this link:
http://www.cyberciti.biz/faq/linux-unix-apache-increase-php-upload-limit/
You can call in your script ini_set function and change values, which have been stored in php.ini (any changes has affected only for current script, but not for global settings)
ini_set('post_max_size', "%value in MiB for example 16M%")
ini_set('upload_max_filesize', "%value in MiB for example 16M%")
You can read more about it at php.net
If you can't resolve the PHP limitation easily, an alternative is to FTP the installation file to the /tmp folder and in Extension Manager -> Install, use the "Install from Directory" option instead.
Had the same issue for the longest time, none of the answers helped. Found that if you are using GoDaddy, and go to your CPanel, scroll down to Software, then choose PHP version, switch to PHP Options, there you can change your upload file size. Hope this helps, took me forever to find it.
Some people might be having a issue with the memory allocation portion of php.ini file "memory_limit" the default for me was 128mb and i was attempting to upload nearly 300mb and it hit that roadblock. After changing the default value to 512mb and restarting the server i was able to get past this limit.
How to change post_max_size and upload_max_filesize in a local installation of Joomla 3 in XAMPP
You can check the php setting in two places – site’s backend under system information – go to php information. Or on browser go to localhost and click on phpinfo. You’ll find the post and upload part under “Core” heading.
Go to c:\xampp\php\
Find the file php.ini
Open php.ini in notepad
Find post_max_size and change value to 20M
Find upload_max_filesize and change value to 20M
Save the file
Logout out of your site backend.
Turn off apache and mysql on xampp and quit
Restart xampp as administrator
Turn on apache and mysql
Open browser and go to localhost
Open phpinfo and search for upload_max_filesize and post_max_size.
Confirm that changes are registered.
This can also happen with the following suhosin setting:
suhosin.upload.disallow_binary = On
Setting it to off temporarily allows you to upload zip files
If you use CPanel, search for PHP version (in the Software section) and click on it, then click on 'switch to PHP Options', the options will display then look for 'upload_max_filesize' and click on the value to change it. Do the same for 'post_max_size'.

Overwrite php.ini settings on IIS

I tried to make an PHP upload form on a windows server, but the upload didn't work because there's no temporary directory. I checked which value is set for the upload_temp_dir and phpinfo() says "no value".
Is it possible to overwrite the php.ini settings for upload_tmp_dir on a IIS? I have no access to the php.ini file. I looked for a possibility to change it with help of a web.config file, but with no result.
have a look at the function
init_set()
http://php.net/manual/en/function.ini-set.php
You can change PHP config by creating a ".user.ini" file. For example, the following will enable the short open tag for your site:
short_open_tag = On
Upload the file to the root directory of your site.
If the PHP version is 5.3 or 5.6 the file name is: user.ini
For any other PHP version the file name is: .user.ini

Categories