I've seen several questions with the same problem and most propose the following solutions
increse the post_max_size in the php.ini file (set to 8M)
increse upload_max_filesize in php.ini file (set to 8M)
set the LimitRequestBody directive in httpd.conf (set to 8388608 = 8M)
none of them worked for me!
Then I restarted the apache service but even still the same problem. the form I am trying to send has only 5 fields (two checkboxes, 2 selects, one file), I'm uploading a file of 653KB and dont work (work if the file is less 80K), never had this problem before.
Setup:
ArchLinux
x86_64 Linux 3.10.6-2-ARCH
PHP 5.4.18
Apache/2.2.25
Virtual host with SSL enabled
I found that the problem is when I have SSL enabled, it has a default configuration SSLRenegBufferSize in 131072 (128k).
Adding this directive in the virtual host directory I can increase the size and the error no longer appears:
<VirtualHost *:443>
# ...
<Directory ...>
#...
SSLRenegBufferSize 8388608 # 8M
</Directory>
</VirtualHost>
add only
SSLRenegBufferSize 8388608
(without # 8M )
Related
Im trying to backup a wordpress website from host and move it back on my local host and keep it as a sample for rebuilding. If have any workaround or maybe other methods I`m all ears
I backedup my website and database also, but when I`m trying to "Import" my sql database I always get the fallowing error Fatal error:
Maximum execution time of 360 seconds exceeded in
C:\wamp\apps\phpmyadmin4.1.14\libraries\import.lib.php on line 345
The database is kind of big 203MB and I archived it aiesecbu_achieve.sql.zip 55.8 MB
I can say that I`ve already tried this: Fatal error: Maximum execution exceeded
and modifying my php.ini
post_max_size = 400M
upload_max_filesize = 250M
memory_limit = 128M
I have uploaded my database for you to test it if you want(maybe it`s something wrong with it) and a screenshot
https://www.dropbox.com/s/cx9wava7sptf4km/mysql.jpg?dl=0
You can try to use mysql console.
Run cmd command
Type c: or d: on command prompt. This will be based on your WAMP server installations.
Assuming you have installed wamp on D: drive.
D:\>cd wamp
D:\wamp>cd bin
D:\wamp\bin>cd mysql
D:\wamp\bin\mysql>cd mysql15.1.36
D:\wamp\bin\mysql\mysql15.1.36>cd bin
D:\wamp\bin\mysql\mysql15.1.36\bin>mysql.exe -u root
use database
source source.sql
Bassicaly you login into mysql, use database determines which database you want to use, source /source/to/source.sql determines which sql you want to run. Pretty easy and efficient.
As you have phpMyAdmin4.1.14 installed I assume you are using WAMPServer 2.5
In WAMPServer 2.5 the PHP resources used by phpMyAdmin are controlled from the phpMyAdmin alias config file. It was changed for exactly these situations, so you dont have to change the php.ini to add a ridiculously large values to parameters that effect your whole PHP environment.
So to increase the relevant paameters you would do this :-
Edit \wamp\alias\phpmyadmin.conf which should look like this by default
Alias /phpmyadmin "c:/wamp/apps/phpmyadmin4.1.14/"
# to give access to phpmyadmin from outside
# replace the lines
#
# Require local
#
# by
#
# Require all granted
#
<Directory "c:/wamp/apps/phpmyadmin4.1.14/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
<IfDefine APACHE24>
Require local
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from localhost ::1 127.0.0.1
</IfDefine>
php_admin_value upload_max_filesize 128M
php_admin_value post_max_size 128M
php_admin_value max_execution_time 360
php_admin_value max_input_time 360
</Directory>
Now change the parameters here, so they only effect what happens when you are running phpMyAdmin.
These are the parameters you should amend
php_admin_value upload_max_filesize 500M <-- and probably this
php_admin_value post_max_size 128M
php_admin_value max_execution_time 620 <-- this for a start
php_admin_value max_input_time 360
But basically try a modification and see if it works, if not depending on the error amend the relevant parameter.
Dont forget to restart Apache after each change you make to this file
Oh and dont forget to undo the changes you made to php.ini
For the latest version of wamp server:
Wampserver 2.5.17 32bits
Apache 2.4.17/2.2.31
PHP 5.6.14/7.0.0rc5/5.5.30/5.4.45/5.3.29
MySQL 5.6.27/5.7.9/5.5.46/5.1.73/5.0.83
PhPMyAdmin 4.5.0
MysqlDumper 1.24.4 (W7 Pro 64bits)
try this out:
In wamp\alias\phpmyadmin.conf file, just before the last statement </Directory> add four statements to obtain:
php_admin_value upload_max_filesize 512M
php_admin_value post_max_size 512M
php_admin_value max_execution_time 900
php_admin_value max_input_time 900
</Directory>
I've been trying to increase the php memory_limit in MAMP (Mac OSX). The version of PHP I'm using is 5.4.1.0. I've read about creating a new template for MAMP Pro, but I'm using the standard version of MAMP.
I've tried all of the below, but nothing seems to have worked. Any help would be much appreciated.
Thank you for your time.
I've added the following to my site's htaccess file, which is read by the site and works (ExpressionEngine). But the master PHP limit is still not updating.
php_value memory_limit 128M
I've changed the following from 32M to 128M in the following file:
/Applications/MAMP/conf/php5.4.10
memory_limit = 128M ;
I then quit MAMP entirely and restarted it, but in MAMP phpInfo it still reads:
memory_limit 32M
Virtual Hosts
I am using Virtual Hosts to set my own URLs. I read somewhere that it may be necessary to increase the memory limit here. So I added this to the 'php_value memory_limit 128M':
/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot /Applications/MAMP/htdocs
ServerName localhost
php_value memory_limit 128M
</VirtualHost>
and lower down in the same file in the relevant site's configuration:
<VirtualHost *:80>
DocumentRoot "/Users/Username/Dropbox/Dev/sitename.dev"
ServerName sitename.dev
php_value memory_limit 128M
</VirtualHost>
(By the way, I keep my MAMP folder (Dev) in Dropbox and it works fine)
php.ini
I also added a php.ini file with the following contents in both the root of my site directory and the root of my MAMP directory:
memory_limit = 128M
Managed to solve it ;-)
The correct one is:
/Applications/MAMP/bin/php/php[your_php_version]/conf/php.ini
find 'memory_limit' and increase the number:
memory_limit = [number]M
Thanks!
Make an phpinfo.php and put there the phpinfo(); in the output you can see the loaded configuration files and the values.
Edit the loaded php.ini file and set the memory limit. I think you have edited the wrong php.ini file or your application set the value over memory_limit.
I have been chasing this for a couple hours, trying to scrub through all my php.ini files trying to update the settings with a text editor and saving it. And every time I'd restart MAMP the settings would get changed back and the file would be overwritten. So here's how I did it where I finally didn't get overwritten by MAMP.
In MAMP, use the menu to get to version of PHP you are using. Mine is 7.3.1 at this time.
MAMP > File > Edit Template > PHP(php.ini) > 7.3.1
An editor window will open, then use the search bar to find your setting... memory_limit
Update your setting
Cmd + S then close the editor window OR just close the editor window and click "Save" when you are prompted
MAMP will then automatically re-start the servers with the new settings
In Mamp Pro and PHP version 7.2.8 ,you can find configuration file in this path:
/Applications/MAMP/bin/php/php7.2.8/conf/php.ini
But according to phpinfo(); My loaded configuration file is in different path! It is here:
/Library/Application Support/appsolute/MAMP PRO/conf/php7.2.8.ini
Also don't forget restart Mamp Pro.
Coming here after facing the same problem with PHP v.7.2. To fix this I needed to go to the path /usr/local/etc/php/7.2/conf.d/php-memory-limits.ini and change the following:
; Max memory per instance
memory_limit = 2048M
Anything else I tried would not change it.
Now I don't get this errors when trying to pull packages with composer in my projects (Fatal error: Allowed memory size of 536870912 bytes exhausted...)
I was able to set memory_limit with MAMP PRO 5.5 on MacOS here :
/Applications/MAMP/bin/php/php7.3.8/conf/php.ini
PHP mode is Individual PHP version for every host (CGI mode)
I've installed EasyPHP WAMP for local development only (I'm not hosting any websites).
Is there a way to set custom php settings for separate virtual hosts?
Currently and out-of-the-box, the php.ini file is loaded from: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\binaries\php\php_runningversion\php.ini It would be nice if, say, I could drop in a custom php.ini file into the virtual host directory to override settings in the original php.ini This way, I could better emulate a production server's environment on a per-site basis.
I've seen this work with online hosting accounts. But I can't figure out how to make this work on my machine.
Using custom php.ini files is pretty straighforward for CGI/FastCGI based PHP installations but it isn't feasible when running PHP as Apache module (mod_php) because the whole server runs a single instance of the PHP interpreter.
My advice:
Set from PHP itself as many settings as you can:
ini_set('memory_limit', '16M');
date_default_timezone_set('Europe/Madrid')
...
In other words, directives that can be changed at runtime.
Set the rest of stuff from per-directory Apache setting files (aka .htaccess):
php_flag short_open_tag off
php_value post_max_size 50M
php_value upload_max_filesize 50M
i.e., settings that need to be defined before the script starts running
Please have a look at the Runtime Configuration for further details.
Sometimes, you'll actually need different settings in development and production. There're endless ways to solve that with PHP code (from creating a boolean constant from the $_SERVER['HTTP_HOST'] variable to just having a config.php file with different values) but it's trickier with .htaccess. I normally use the <IfDefine> directive:
<IfDefine DEV-BOX>
#
# Local server directives
#
SetEnv DEVELOPMENT "1"
php_flag display_startup_errors on
php_flag display_errors on
php_flag log_errors off
#php_value error_log ...
</IfDefine>
<IfDefine !DEV-BOX>
#
# Internet server directives
#
php_flag display_startup_errors off
php_flag display_errors off
php_flag log_errors on
php_value error_log "/home/foo/log/php-error.log"
</IfDefine>
... where DEV-BOX is a string I pass to the local Apache command-line:
C:\Apache24\bin\httpd.exe -D DEV-BOX
If you run Apache as service, the -D DEV-BOX bit can be added in the Windows registry, e.g.:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Apache2.4\Parameters\ConfigArgs
Related: Find out how PHP is running on server (CGI OR fastCGI OR mod_php)
Developing Multiple Domains on One Machine?
Embedding php.ini settings in the httpd-vhost.conf, typically found in your server root under conf/extra/, is a great way to solve this common problem. If you never knew you could do this, see the PHP.net Manual under How To Change Configuration Settings. This will solve the pesky include_path problem, without adding configuration code to your bootstrapping code or anything else.
Of course, to use this effectively as localhost, you would need to make copies of a <VirualHost> block and configure each accordingly. Then, comment out all virtual host blocks except the one that you want to use!
Alternatively, one could start Apache with the -f option to point the server daemon to a different httpd.conf upon starting. Each httpd.conf would require an "if module block," such as and <IfModule phpx_module> block. Be sure to remember to account for Apache logging!
httpd -f /usr/local/apache2/conf/domains/fooDomain.conf
httpd -f /usr/local/apache2/conf/domains/barDomain.conf
Virtual Host Block With php.ini statements.
<VirtualHost 127.0.0.1:80>
UseCanonicalName On
ServerName localhost:80
ServerAdmin you#localhost
CustomLog "/var/www/someDomain.com/data/logs/httpd_access_log" common
ErrorLog "/var/www/someDomain.com/data/logs/httpd_error_log"
LogLevel warn
DocumentRoot "/var/www/someDomain.com/public"
<Directory "/var/www/someDomain.com/public">
# disable directory listing
Options -Indexes +FollowSymLinks
AllowOverride FileInfo
Require all granted
</Directory>
<IfModule alias_module>
# Alias /webpath /full/filesystem/path
ScriptAlias /cgi-bin/ "/var/www/someDomain.com/scripts/cgi-bin/"
</IfModule>
<IfModule php7_module>
# Use php7_module in opening statement above if on PHP 7+
# Domain specific PHP configuration options.
# The Apache process user must own any of the following directories.
php_admin_value include_path "/var/www/someDomain.com/application/controllers:/var/www/someDomain.com/application/models:/var/www/someDomain.com/application/views"
# Errors and Logging
php_admin_flag display_startup_errors off
php_admin_flag display_errors off
php_admin_flag html_errors off
php_admin_flag log_errors on
php_admin_value error_log "/var/www/someDomain.com/data/logs/php_error_log"
# File Related
php_admin_flag file_uploads on
php_admin_value upload_tmp_dir "/var/www/someDomain.com/data/uploads"
php_admin_value upload_max_filesize 10M
php_admin_value max_file_uploads 5
# Sessions
php_value session.save_handler "files"
php_value session.save_path "/var/www/someDomain.com/data/sessions"
# Caching
php_value soap.wsdl_cache_dir "/var/www/someDomain.com/data/cache/sopa.wsdl"
</IfModule>
</VirtualHost>
If you could use the %{SERVER_NAME} variable in conjunction with the <IfModule phpx_module> blocks to form a compound conditional, you could have just one httpd.conf`, or include a extra/php.conf with all the domain specific PHP.ini settings (in blocks, also). However, as long as "localhost" is the domain target, it will not do what you want. Thus, my answer in the virtual host block above.
Simple way to use custom php.ini file for vhost using Fast CGI is to copy the php.ini into a folder in the host like "customini".
After that to your vhost directive and add this simple line :
FcgidInitialEnv PHPRC "/path_to_your_custom_ini_dir_for_this_vhost/"
BE SURE TO HAVE / to your path no \, (it won't work with \)
Restart Apache.
That's all!
Full sample (on Windows Server here) :
<VirtualHost *:80>
DocumentRoot "C:/APACHE/htdocs/vhost/myvhost"
ServerName www.vhost.com
FcgidInitialEnv PHPRC "C:/APACHE/customini/myvhost/"
</VirtualHost>
Several commentors have mention Vagrant which is an excellent solution.
If you're not interested in using Vagrant, you can investigate using FastCGI as your interface to Apache and using the SetEnv PHPRC... suggestion proposed on this blog:
Apache & PHP: Multiple PHP.ini Configuration Files (Sunday, February 8, 2009)
Source: http://hyponiq.blogspot.com/2009/02/apache-php-multiple-phpini.html
The second work-around is to use the PHPRC environment variable
configurable in Apache using the SetEnv directive. This directive
allows you to set an environment variable that is then passed to any
CGI script and/or Server Side Include (SSI) set in any static (x)HTML
page (or other document type). In this instance, you'd be telling each
PHP-CGI instance where to find its configuration settings. The example
would be (coinciding with the previous one):
# vhosts.conf
NameVirtualHost *:81
<VirtualHost *:81>
ServerAdmin admin#example.com
ServerName vhost.example.com
DocumentRoot "C:/path/to/doc/root"
ErrorLog "logs/vhost.example.com-errors.log"
# Set the PHPRC environment variable
SetEnv PHPRC "C:/path/to/doc/root/php.ini"
<Directory "C:/path/to/doc/root">
# ... yadda, yadda, yadda ...
# you get the point!
</Directory>
</VirtualHost>
However, the PHP documentation changing the runtime
configuration
suggests that you can use certain values like php_value to try
loaalong with, possibly the SetEnv directive.
He suggests another option not using FastCGI, instead leveraging the php_value, php_flag etc. configuration options.
Other's seem to have had some success with executing scripts through FastCGI though, see: Separate php.ini for different virtual hosts
Other suggestions involve the PHPINI directive, which may be pertinent for your needs, see: How do I limit PHP apps to their own directories and their own php.ini?
I have xenforo and yetishare. In both, when i try to upload files around 256 mb, the progrss bar starts, goes till 150mb + and then the progess bar again comes back to 0% and start uploading again. It does like 4 times then shows error that the file can't be uploaded.
I can upload a file, 126mb without any problem.
My Php Info : http://dl.godgivens.com/temp.php
I have set them temp directory of php to /tmp and uploaded a .htaccess file there with this settings, [these are the only lines in it]
LimitRequestBody 0
php_value upload_max_filesize 0
php_value post_max_size 4939212390
My file uploader, is index.php, and the .htaccess file also has the above settings as well as the folder which the files are saved also have the above settings.
You could see my php.ini settings, link i gave above.
IN httpd.conf under my httpd folder in /etc i have set timeout to 900.
I couldn't find limit request body anywhere.
In php.conf, i have added this to the last section,
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 0
</Files>
and i have added this line to fcgid.conf,
FcgidMaxRequestLen 1073741824
So it looks like,
# This is the Apache server configuration file for providing FastCGI support
# via mod_fcgid
#
# Documentation is available at http://fastcgi.coremail.cn/doc.htm
LoadModule fcgid_module modules/mod_fcgid.so
<IfModule mod_fcgid.c>
<IfModule !mod_fastcgi.c>
AddHandler fcgid-script fcg fcgi fpl
</IfModule>
FcgidIPCDir /var/run/mod_fcgid/sock
FcgidProcessTableFile /var/run/mod_fcgid/fcgid_shm
FcgidIdleTimeout 40
FcgidProcessLifeTime 30
FcgidMaxProcesses 20
FcgidMaxProcessesPerClass 8
FcgidMinProcessesPerClass 0
FcgidConnectTimeout 30
FcgidIOTimeout 45000
FcgidInitialEnv RAILS_ENV production
FcgidIdleScanInterval 10
FcgidMaxRequestLen 1073741824
</IfModule>
I have also added edited it, in domain configuration, nginxdomainvirtualhost.php.
Rebooted servers, reloaded httpd, restarted https, reconfigured things, but still it is just as same as before:/
I want to be able to upload 1gb-2gb files in my forum.
Here is the example of it uploading,
Please see the link below to see it uploading.
http://gyazo.com/c40cb03c503f172a3bc737d688f7cb00.gif
This is the one I followed : 4GB HTTP File Uploads Using jQuery-File-Upload, Apache and PHP
I thing this is because your hosting provider has given upload limit 126...
so you must ask your hosting provider to increase upload limit or you can use client side ftp upload script (flash/java) to handle file upload. But for client side ftp upload you need to modify your yetishare script
i am using an html form with php to upload data to mysql.
the form is working properly when i am using it on my laptop (wamp) but when i uploaded the site on my dedicated server (ispconfig) get this error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
i tried changing the values of the php.ini in
post_max_size 64M
upload_max_filesize 64M
max_input_time 3000
max_execution_time 3000
and the ones in the apache also in
memory_limit 96M
post_max_size 64M
upload_max_filesize 64M
but i still cant upload.
thank you for reading this.
You need to increase FcgidMaxRequestLen in httpd.conf file
use something like
FcgidMaxRequestLen 67108864
From FcgidMaxRequestLen Directive
Warning
Before 2.3.6, this defaulted to 1GB. Most users of earlier versions
should use this directive to set a more reasonable limit.
The accepted answer is correct. To be more specific, you need to add the code in httpd.conf file :
# Work around annoying fcgid limitations
<IfModule mod_fcgid.c>
# 20MB should be enough
MaxRequestLen 20000000
</IfModule>
You may check the full article here :
http://pivica.me/blog/500-internal-server-error-while-uploading-files-bigger-then-100kb-modfcgid-problem
Note that a syntax error in a php/ajax processing script could report as an "internal server error".
For example, I was using Ravishanker Kusuma's jQuery Upload File plugin and was getting this message.
Turns out it was just a missing ) in an (unused) function inside my code in the PHP processor file specified by the AJAX script. When a file was uploaded, this script would be called, the script would break inside the unused function, and this is the error it would report.
FWIW
None of the solutions above worked for me.
For CentOS users with Plesk Pannel follow the next steps
Change this value in the template
# grep -ir FcgidMaxRequestLen /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php
FcgidMaxRequestLen 16777216
# sed -i 's/FcgidMaxRequestLen 16777216/FcgidMaxRequestLen 1073741824/g' /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php
# grep -ir FcgidMaxRequestLen /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php
FcgidMaxRequestLen 1073741824
Rebuild the virtualhost configurations.
# /usr/local/psa/admin/bin/httpdmng --reconfigure-all
# /usr/local/psa/admin/bin/httpdmng --reconfigure-server
https://support.plesk.com/hc/en-us/articles/213955145-Unable-to-upload-large-files-via-PHP-HTTP-request-length-exceeds-MaxRequestLen