Is there any method to know what is maximum upload limit for WordPress in cPanel and increase it? - upload-max-filesize

Maximum upload size in my case was only 1 MB. I started to search in settings in the WordPress dashboard but no any settings for that, started to solve it by finding few errors and recommendations that was declared in WordPress site health. I found two recommendations as follows.
!
and in google search I found that this can be changed in cPanel in "select PHP version", but this feature was unavailable, I found this message ""PHP Selector is not available. Please, contact your hoster."
Than I installed plugin that solved my problem.
One of google search I found to add php.ini file in database and put following codes.
For PHP.INI file
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
OR
upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 400M
file_uploads = On
max_execution_time = 180
But after creating this file hosting service put in suspension for sometime. So, is there any safe method to increase upload file size of galary.
Where is current defined file size by hosting service?

You can easily increase the size limits by adding the following lines of code in the functions.php file of your theme.
However, remember if you change the theme then max upload size will return to its default values until you edit the functions.php file of the new theme.
#ini_set( 'upload_max_size' , '64M' );
#ini_set( 'post_max_size', '64M');
#ini_set( 'max_execution_time', '300' );
php.ini Option
upload_max_filesize = 25M
post_max_size = 13M
memory_limit = 15M
Or you can do from wp-config.php File
Open the file in any text editor and add the following code.
#ini_set( 'upload_max_size' , '20M' );
#ini_set( 'post_max_size', '13M');
#ini_set( 'memory_limit', '15M' );

Related

Whoops! We seem to have hit a snag. Please try again later

Whoops! We seem to have hit a snag. Please try again later.
Codeigniter 4 shows an error when I run the CI4 application, How I resolve?
Changes:
public $baseURL = 'http://ci.local';
public $baseURL = 'http://localhost:8080';
public $indexPage = '';
This work for me try it
Go to app directory then to boot directory you will see production.php file.
That is:
app => Config => Boot => production.php
Change the ini_set('display_errors', '0') to ini_set('display_errors', '1').
Warning: When in production change back to initial ini_set('display_errors', '0')
Or
you can rename your file env in your project directory to .env after that open it and edit.
Search for # CI_ENVIRONMENT = production remove # and change production to development
Warning: When in production change back to initial CI_ENVIRONMENT = development to CI_ENVIRONMENT = production
For those experiencing intl error go to where your php installation directory edit the php.ini file remove semi-colon ";" from ;extension=intl to extension=intl. save the file and restart your server. I think this will solve that error. This particular editing of my php.ini was on php 7.2 - 8.1 so I haven't check other version of php lesser than these versions which Codeigniter 4 does not support
After installing CodeIgniter 4 when you run the app then you will get an error like this
To know the error go to the app/Config/Boot/production.php and set display_errors to 1 as below
ini_set('display_errors', '1');
Now, you will see the actual error below
Nothing to worry about it. The app needs permission. Assign the permission like as below
sudo chmod -R 777 project_name
Assume that your root folder of your CI4 project is rootproject.
Edit rootproject/.env file.
On line 17 change from:
# CI_ENVIRONMENT = production
to:
CI_ENVIRONMENT = development
Save it.
Refresh your browser that pointing to your CI4 project.
It should give you many error messages.
If there is something written as CacheException, than your cache folders are not writable.
Make it writable;
Ubuntu:
chown -Rv www-data rootproject/writable
CentOS:
chown -Rv apache rootproject/writable
Easy way:
chmod 777 -Rv rootproject/writable
In your CI4 project root, create a file named .env. It should be in the same directory as system, app e.t.c
Then, add this CI_ENVIRONMENT = development
The problem is most likely due to missing extensions. Check server requirements here.. Check your php.ini file and make sure intl and mbstring are enabled.
I had the same problem, I have a simple solution for Mac.
- in the project folder, go to 'writable'
- select all the folders contained and click on 'get information'
- go share and permissions
- in 'everyone' select 'read and write'
That's it! refresh the page
Try This
Open [xampp]/php/php.ini
Search for ;extension=intl and remove the ;
Save the php.ini file and restart Apache(server).
In Root folder change: env to .env
Change # CI_ENVIRONMENT = production to CI_ENVIRONMENT = development (ensure it is uncommented)
Your error may be related to the knit.php file.
Go to System/Third Party and change: knit.php to Knit.php (Capital)
Reload.
For those using XAMPP in MacOS:
You don't need to change the ownership of the writable directory. You only need to change permission to entire directory:
chmod -R 777 writable
When you change # CI_ENVIRONMENT = production to CI_ENVIRONMENT = development don't forget of rename the env file to .env else it will not work.
You're running in the production environment and need to change it to a Development or Testing environment to see the error messages within the browser.
There are a few ways to do this, but adding:
SetEnv CI_ENVIRONMENT development
To the Apache httpd.config file is what worked for me.
_t
I got the answer for this query; just follow these steps:
From the command line, at your project root just hit this
php spark serve
Then hit this on your browser http://localhost:8080/
Enjoy your Latest CI.
Not sure what the desired answer is, but:
If you are asking to see what is the actual error is - either change
your environment to testing/development (as suggested so far) or you
can check your logs - writable/logs/log-.php
If you wish to solve the error, we will need more information, like have
you setup virtual hosts, have you change .htaccess file in public
folder, etc. Otherwise we will be most likely betting (I bet it's virtual hosts).
In any case, a copy of the displayed error (after changing evnironment) or log file will be useful.
You can check logs file on writable/logs find error information,
If your logs information like :
CRITICAL - 2020-04-19 17:44:55 --> Invalid file: template/header.php
#0 F:\xampp\htdocs\ppdb\vendor\codeigniter4\framework\system\View\View.php(224): CodeIgniter\Exceptions\FrameworkException::forInvalidFile('template/header...')
And go fix your error, in my case i am wrong typed name on controller file
In Codeigniter 4 source code have a folder named writable, just update it's access permission. Sometimes it'll help to get rid of Whoops. Also can check the video for Ubuntu / Linux

Error when starting Cassandra prevents launching

I am trying to run Cassandra. But, I am getting this error:
[root#SudeepMangu bin]# ./cassandra -f
xss = -ea -javaagent:/home/sudeep/apache-cassandra-1.2.5-src/lib/jamm-0.2.5.jar-
XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms930M -Xmx930M -Xmn200M -
XX:+HeapDumpOnOutOfMemoryError -Xss160k
Error occurred during initialization of VM Could not reserve enough space for object heap
I have tried setting JAVA_OPTS to max size with no effect.
See my answer here, https://stackoverflow.com/a/14447535/92463 which describes increasing the stack segment size. Edit the conf/cassandra-env.sh configuration script, at around line 185, and change the -Xss180k to a higher value.
if [ "`uname`" = "Linux" ] ; then
# reduce the per-thread stack size to minimize the impact of Thrift
# thread-per-client. (Best practice is for client connections to
# be pooled anyway.) Only do so on Linux where it is known to be
# supported.
# u34 and greater need 180k
JVM_OPTS="$JVM_OPTS -Xss180k"
fi
echo "xss = $JVM_OPTS"
I suggest testing values starting from -Xss200k and increasing in 20k increments. I have found that using -Xss280k on Ubuntu servers worked successfully.
Probably it's because of the 32bits java version. I changed my JAVA_HOME variable to the 64bits version by following this steps:
1) Hited both "Windows + R" keys and entered: sysdm.cpl
2) On the "System Properties" I pressed the 'Environment variables' button
3) In the textarea "Environment variables" I picked JAVA_HOME and clicked 'Edit'
4.a) In the "Variable Value" I took out the path
(it looks like this: C:\Program Files (x86)\Java\jdk1.8.0_192)
4.b) I Entered the 64bits path instead
it looks like this now: C:\Program Files\Java\jdk1.8.0_73
And that was it. Then I justed watched the cassandra server scipts running through...
And the heap memory problem is gone!
There is not enough space for cassandra. You have to change a value inside cassandra-env.sh file
open the cassandra-env.sh file
sudo vi cassandra-env.sh
In the document you will see JVM_OPTS="$JVM_OPTS -Xss180k"
Increase the chunk size between 250 to 300
Set stack size of 256K in cassandra-env.sh.

Uploading large files with PHP

I am dealing with PHP File Upload. First I am trying with Just HTML/PHP code without any uploaders (uploadify) etc.
The HTML Code
<form method="post" action="" enctype="multipart/form-data">
<label for="upload">Select : </label>
<input type="file" name="file_upload" id="upload" multiple="multiple" />
<!-- 1024 x 1024 x 1024 -->
<input type="hidden" name="MAX_FILE_SIZE" value="1073741824" />
<input type="submit" name="fsubmit" id="fsubmit" value="Upload" />
</form>
The PHP Code
if (isset($_FILES['file_upload']) && $_FILES['file_upload']['error'] == 0) {
move_uploaded_file($_FILES[$field_name]['tmp_name'], '../somepath/.../' . $_FILES['file_upload']['name');
} else {
echo $_FILES['file_upload']['error'];
}
It is uploading the files less then 8Mb. To override the PHP default I change .htaccess to this and restarted apache.
php_value upload_max_filesize 1024M # also tried "1024M"
php_value post_max_size 1024M # also tried "1024M"
php_value max_execution_time 3600
php_value max_input_time 3600
But no luck, it always takes default 8M. I also try to change the settings from PHP code on the fly like this
ini_set('upload_max_filesize', '1024M');
ini_set('post_max_size', '1024M');
ini_set('max_execution_time', '600');
ini_set('max_input_time', '600');
ini_set('memory_limit', -1); // no memory limit
This has also no effect, when I echo ini_get('post_max_size') it shows 8M. The error code return is 2. Show PHP says
UPLOAD_ERR_FORM_SIZE
Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
Now my question is Why it is not able to override from .htacess or PHP code? NOTE I am on VPS server. When I change 8M to xM manually it works. Hope I am clear, thanks in advance...
It seems you missed to add "AllowOverride All" in apache config for the site directory...because of this your values in htaccess are not overridden..
check these links
http://forum.owncloud.org/viewtopic.php?f=8&t=1809
http://blog.triphp.com/lessons/htaccess/allow-override
Hope it helps !
If you edit directly php.ini with something like this:
php_value upload_max_filesize 750M
php_value post_max_size 750M
and it works, what's the problem? You are not being able to do it in the other way, but what's wrong this way?

Problems configuring my site to use a custom php.ini file for all directories

PHP 5.2.17
joomla 1.6.4
1and1 Linux shared server
php is running as cgi
Hi, I am trying to use a custom php.ini throughout my website. I know I can put a php.ini file in each folder, but that would not be feasible.
I searched online and found the following method:
1 - create your custom php.ini file and put it inside path/to/your/website/cgi-bin folder
2 - create the following php.cgi file
#!/bin/sh
exec /usr/local/bin/php5 -c path/to/your/website/cgi-bin
3 - upload php.cgi to /path/to/your/website/cgi-bin
4 - chmod +x php.cgi to make it executable
5 - include the following line inside .htaccess in my website root
Action application/x-httpd-php5 /path/to/your/website/cgi-bin/php.cgi
According to my understanding, after doing the above, php scripts on my website would start using my custom php.ini file instead of the default one.
Anyone can help? I spent a better part of the day trying to resolve this issue without success.
By the way, my account root (one level above my website root) has a .htaccess file with the following lines:
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
Thank you.
UPDATE 9/2/2011 - 19:37
tried including the following statement in .htaccess
SetEnv PHPRC /path/to/my/website/cgi-bin <- where my custom php.ini file is located.
According to this website it should have worked -> http://support.premiumreseller.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=85
But still nothing.
I will keep trying.
Any help appreciated!!!
UPDATE 2 - 9/3/2011 - 0:03 (WORKAROUND)
So, I couldn't find a solution for my problem. I decided to create a small php script to create hard links to php.ini in each directory that has a php script.
See below the code in case you are curious:
<?php
define('ROOT_DIR', $_SERVER['DOCUMENT_ROOT']);
define('FILE_PHPINI', ROOT_DIR . "/cgi-bin/php.ini");
processdir(ROOT_DIR);
function processdir($path)
{
$FlagNoPHP = true;
$localPHPINI = $path . "/php.ini";
foreach ( new DirectoryIterator($path) as $file)
{
if (!($file->isDot()))
{
if ($file->isDir())
{
processdir($path . "/" . $file);
}
else if ($FlagNoPHP && fnmatch("*.php*", $file))
{
$FlagNoPHP = false;
if (!file_exists($localPHPINI))
{
link(FILE_PHPINI, $localPHPINI);
}
}
}
}
if ($FlagNoPHP)
{
if (file_exists($localPHPINI))
{
unlink($localPHPINI);
}
}
}
?>
The above code looks inside each directory in my website and:
1 - if there is a php script and NO php.ini, creates a hard link to php.ini
2 - if there is NO php script and there is a php.ini, deletes the hard link (done in the last if of the function). I included this in order to clean up the filesystem of old php.ini files.
This worked for me.
I am still curious about an answer to my original problem.
I hope this helps someone!
Seems like you're taking the long way. Just modify .bashrc:
export PHPRC="/Volumes/Mac_Daddy/web_curr/public_html/php_osx.ini"
Result:
Configuration File (php.ini) Path: /usr/local/php5/lib
Loaded Configuration File: /Volumes/Mac_Daddy/web_curr/public_html/php_osx.ini
Scan for additional .ini files in: /usr/local/php5/php.d
Additional .ini files parsed: /usr/local/php5/php.d/10-extension_dir.ini
Or create an alias:
alias myphp="/usr/local/php5/bin/php -c /somewhere/someplace/php.ini"
or better yet man php.

PHP deprecated warnings on Drupal pages despite turning them off in php.ini

I have PHP deprecated errors flooding log files and Drupal status pages like this:
: Function ereg() is deprecated in mysite/includes/file.inc on line 893.
I should be able to turn off E_DEPRECATED errors in my php.ini, but it is having no effect despite being set to:
error_reporting = E_ALL & ~E_DEPRECATED
phpInfo() reports error_reporting master value and local value both 22527.
I did a
grep -R error_reporting
in my document root in the hopes of finding any hard coded error levels and no luck:
./includes/common.inc: // If the # error suppression operator was used, error_reporting will have
./includes/common.inc: if (error_reporting() == 0) {
./modules/system/system.module: 'page arguments' => array('system_error_reporting_settings'),
./modules/system/system.admin.inc:function system_error_reporting_settings() {
./modules/system/system.install: $err = error_reporting(0);
./modules/system/system.install: error_reporting($err);
Nothing that I can see that is supect except possibly the first line in system.install but if I'm right that should turn all errors OFF.
I'm not setting error_reporting in .htaccess, but doing that does not have any effect either.
I'm hoping that there is a solution that doesn't involve hard coding error levels in common.inc (which DOES work, I've tried - but obviously undesirable).
I know the deprecated errors are a result of upgrading to PHP 5.3, but downgrading PHP is not option (new sites are going live now on the same server that have been tested on 5.3, and the sites where these errors occur have 2 months to live). I also cannot upgrade to Drupal versions that play nicely with 5.3 as unfortunately the previous owner haxxed the core modules without documenting his changes.
Version stuff:
PHP 5.3.2-1, Ubuntu 10.04, Drupal 6.13 on one site, 6.5 (!!1!) on the other, Apache 2.2
Did you try editing index.php to be
error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
I have used this on my php.ini file and could hide those deprecated errors. Hope it helps you! =)
error_reporting = E_ALL & ~E_DEPRECATED & -E_WARNING
I don't know about disabling error reporting but you can replace all ereg functions by preg_match..!

Resources