Cannot upload image above 75 kb [duplicate] - php

This question already has an answer here:
php image upload errors [duplicate]
(1 answer)
Closed 9 years ago.
I successfully uploaded an image below 70 kb on server. manage server cpanel view already set php.ini file
max_upload =2000mb
max-exe-time = 300
max input time =600
n php.ini file everything is ok.
My problem above 70kb image can't move temp directory
i cant understand im using zend framework and java script using
Server Error log display following error
[Thu Jun 20 20:53:32 2013] [error] [client 59.164.48.115] PHP Fatal error: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in /home/indepet/application/modules/cms/controllers/ProductController.php, line 1' in /home/indepet/library/Zend/Controller/Response/Abstract.php:321\nStack trace:\n#0 /home/indepet/library/Zend/Controller/Response/Abstract.php(148): Zend_Controller_Response_Abstract->canSendHeaders(true)\n#1 /home/indepet/library/Zend/Controller/Action/Helper/Redirector.php(223): Zend_Controller_Response_Abstract->setRedirect('/index/home', 302)\n#2 /home/indepet/library/Zend/Controller/Action/Helper/Redirector.php(301): Zend_Controller_Action_Helper_Redirector->_redirect('/index/home')\n#3 /home/indepet/library/Zend/Controller/Action/Helper/Redirector.php(381): Zend_Controller_Action_Helper_Redirector->setGotoSimple('home', 'index', NULL, Array)\n#4 /home/indepet/library/Zend/Controller/Action/Helper/Redirector.php(502): Zend_Controller_Action_Helper_Redirector->gotoSimple('home', 'index', NULL, Array)\n#5 [internal fun in /home/indepet/library/Zend/Controller/Response/Abstract.php on line 321, referer: my site name
sometimes 100 and 100 above kb image file upload successfully again
i was try image upload following error show
another doubt
same code work other servers successfully im using Australia server

This error isn't related to upload size, instead Zend is trying to print headers after something has already been rendered (possibly because there's been an error and it's trying to redirect). Check for anything that may have been outputted in your view controller. White space at the end of the file is an easy one to miss - in fact, it's good practice to not use a closing PHP tag ?> at the end of the file for this reason.

Related

PHP 5.6, find an explanation for seemingly unexplainable errors

someone could tell me if there is a reason why I get these PHP errors, which should not exist.
PHP Warning: include (xyz.php): failed to open stream: No such file or directory in /mypath/myfile.php on line 351
When the file clearly exists!
PHP Fatal error: Can not access MyClass::$myproperty in /mypath/MyClass.php on line 250
When the declaration exists:
class MyClass
{
...
public static $myproperty = array();
...
I would like to emphasize that these errors are not always reported! But only once in a while. When I make a mistake writing a part of the code, the PHP fatal error should always occur, not 5 times a day from 12:22 to 12:27 and nevermore. I'm talking about a site from thousands of visits a day, I'm also talking about a .php file that is included on a regular basis in every request of any page.
I can't get any error in my pc (php 5.6 also) when I run and test the web application.
Is it possible some server problem?
Thanks.

How to fix PHP Excel export error in application system

Normaly in my application system i am able to export content via PHP Exel. Now i can export the .xlsx file but if i would like to open it ill get the message : Can not open file because format or filename extension is invalid.
Error Code :
Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file php://output.' in
/net/myvm0364/disc1/www/pc2/application/include/847dfknsa_2434_phpExcel/PHPExcel/Writer/Excel2007.php:346
Stack trace: #0
/net/vmits0364/disc1/www/pc2/application/include/exportMember.php(188):
PHPExcel_Writer_Excel2007->save('php://output') #1 {main} thrown in
/net/myvm0364/disc1/www/pc2/application/include/847dfknsa_2434_phpExcel/PHPExcel/Writer/Excel2007.php
on line 346
Did somebody know what i have to do ?
I have seen a similar case before on my server (then I used CSV because do not solve problem). The reason is that the excel file is too large (about 40000 or 50000 records, or file size larger than 15MB), making your server can't handle, so excel file will be broken.
Example:
The file content if successfully created is 20MB, but when the file creates 15MB, your server is overload, it will stop the process here. You can still create an excel file but can't open it.
You can try creating an excel file with a capacity of about 1MB or less than, if it work the problem may not be due to your code.
Hope can help you.
So sorry because bad english.

PHP 7 include file error - file name is parsed incorrectly

Recently I met a weird error and hope someone can help.
We use LiteSpeed WebServer and Nginx on top, with PHP 7.5 and MySQL 5 (well, WordPress is the framework). It runs well for many days.
Suddenly it goes fatal at this line in different files
include ("class-xxx.php");
The error log says
[02-Oct-2018 13:04:36 UTC] PHP Fatal error: require(): Failed opening required 'dlass-xxx.php' (include_path='.:/opt/cpanel/ea-php72/root/usr/share/pear') in /xxx.php on line N
I double checked the code and see that the file name is declared "class-xxx.php", but somehow the server tries to include "dlass-xxx.php", thus it cannot find the file and trigger fatal error.
Solution? I re-upload the file, it works. But then it goes fatal in another file, at similar lines using include.
I notice that the first character in the file name, for example "c", is read incorrectly and shift 1 byte before (or after), so the file name is correct.
Such as
include "class-xxx.php" is parsed/read as "dclass-xxx.php"
include "page-xxx.php" is parsed"read as "opage-xxx.php"
...
this is very strange. Do anybody know the reason? Is it related to any caching/memory management of LiteSpeed or Nginx or PHP 7. ?
It happens on PHP 7. only because if I switch to PHP 5.6, the error does not happen.
Hope someone can help. Thanks a lot.

copy(): Filename cannot be empty error (only occasionally)

I have a strange php issue.
I have a custom front-end post submission form for WordPress. It most of the time but the other times it seemingly at random doesn't work.
My PHP error log spits out the following:
PHP Warning: copy(): Filename cannot be empty in /home/y567889/public_html/wp-content/themes/colormag/inc/front_deck.php on line 1071
PHP Warning: file_get_contents(https://ygoprodeck.com/pics/Trinity World Chalice-deck-14461.png): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/y567889/public_html/wp-content/themes/colormag/inc/front_deck.php on line 1025
PHP Warning: unlink(/home/y567889/public_html/pics/Trinity World Chalice-deck-14461.png): No such file or directory in /home/y567889/public_html/wp-content/themes/colormag/inc/front_deck.php on line 172
So in theory, a user could submit 10 posts. Sometimes 2 of those posts would generate with errors (missing featured image etc etc) with the above error in the php log.
What I have tried:
Changed copy() to move_uploaded_file() with no joy.
Changed permissions on the "pics" folder to 775.
It occurs to one of my users in particular. It happens him with every post he attempts to upload. Generating a new WP account fixes this for him (although it still fails occasionally as per usual).
Because the error starts at line 1017 I'll show what the code is for that:
function moveYdktoDeck($ydkId,$postid){
$ydkUrl = wp_get_attachment_url( $ydkId );
$newfile = $_SERVER['DOCUMENT_ROOT'].'/UploadedDecks/3/'.$postid.'.ydk';
copy($ydkUrl, $newfile)
}
Function wp_get_attachment_url can return false. Check that before you use it in copy function.

What can cause a web server to not find an XML file?

I have a PHP script which reads from an xml file to generate a table. The first thing it does is check to make sure the file exists.
$path = getcwd();
if(file_exists($path.'\inc\php\kbs.xml')){
$kbs = simplexml_load_file($path.'\inc\php\kbs.xml');
} else {
echo "Error: No KB file found";
}
For some reason, intermittently, it doesn't find the file. I've tried removing the file_exists check all together (since I know the file does exist) but it still doesn't load the file at times. I can refresh the page and 7 times out of 10 it doesn't load, but sometimes it does.
I never ran into this problem during development, but once it went production (being used by maybe 200 users now) it started happening.
How do I go about troubleshooting this? (PHP 5.2.14 running on IIS)
EDIT: Error logs give me the following messages when it fails:
Notice: Undefined variable: kbs in <the path> on line 16
Notice: Trying to get property of non-object in <the path> on line 16
Warning: Invalid argument supplied for foreach() in <the path> on line 16
line 16 is the first time the variable $kbs is accessed. Obviously $kbs isn't set if the file isn't found.
Please use the absolute path, relative path make things a mess.
Is the location relative to PHP? Do permissions allow the web server to see it?

Categories