I'm having an issue with Mantis Bugtracker (version 1.1.8), where file downloads only reach 4 Kb, and then stop. I don't know if this is a problem in the product itself, or in the PHP installation on the server. I've tried disabling output buffering (that was the only value close to 4Kb), but that didn't help.
The files are stored in the database. The application is running on IIS7 on Windows Server 2008 and Sql Server 2005, and the installed version of PHP is 5.2.11.
Does anyone have a solution that might help fix this?
Okay, I think that I'm just going to have to face the fact that I'm an idiot. I had changed the textsize and textlimit properties in php.ini for MSSQL, but I missed the semicolon in the beginning of the lines. I just uncommented those two lines, and now it works like a charm.
; Valid range 0 - 2147483647. Default = 4096.
mssql.textlimit = 2147483647
; Valid range 0 - 2147483647. Default = 4096.
mssql.textsize = 2147483647
OK ... 1st thought would be that it is bizzarly timing out?
You could try setting a max timeout...
Also, knock up an independant bit of code to fetch and download file - to rule out/in any bugs in Mantis ... I use a Mantis but hosted on linux and it all works fine - same vervsion but linux and mysql...
OK A quick serach on mantis's forum gave me: http://www.mantisbt.org/forums/viewtopic.php?f=3&t=4712 which describes exactly what you have happening and it is indeed a specific Windows/ISI/SQL Server thing ;)
Related
I have a php script for multiple upload of files.
I noticed that when the upload takes more than (about) two minutes I get the following error:
500 - Internal server error. There is a problem with the resource you
are looking for, and it cannot be displayed.
Some info:
PHP Version: 5.4.23
System: Windows NT SDADMIN32263436 6.1 build 7601 (Windows Server 2008
R2 Standard Edition Service Pack 1) i586
Any tips?
Thank you
By default PHP only allows upload of files a couple of meg big. You could try changing the following directives in the php.ini file ....
memory_limit = 32M
upload_max_filesize = 24M
post_max_size = 32M
Obviously use values that are appropriate to you.
It could however not be linked to the upload size at all. As PHP is server side, the 500 error is incredibly generic. You can try looking at your PHP log files (you can do this on IIS through server 2008).
It might also help you to turn on some error catching in your application. For development, one way to do this is to put the following at the top of your PHP script
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
This will mean PHP will show any errors it encounters in the browser. It is NOT a good idea to this in production though, as it can give sensitive information about your server and hosting out.
I refer to this question. This user seems to have the same problem of yours and in this answer he was suggested make some changes in the configuration file:
"max_execution_time" integer
This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. This helps prevent poorly written scripts from tying up the server. The default setting is 30. When running PHP from the command line the default setting is 0.
The maximum execution time is not affected by system calls, stream operations etc. Please see the "set_time_limit()" function for more details.
[...]
"max_input_time" integer
This sets the maximum time in seconds a script is allowed to parse input data, like POST, GET and file uploads.
[...]
Additionally here's some info on checking/setting CGI Timeout in IIS5 and 6.
I also suggest you to check the PHP error logs in order to retrieve more information about the upload execution.
Finally in this question and this question they also talk about the IIS configuration in order to allow PHP to make bigger uploads.
Currently, when I visit localhost/phpmyadmin, I am seeing the following error:
ERROR: Token Mismatch (In tooltip)
Incorrect format parameter
I will explain the changes I did step by step:
I had xampp of version 1.7.1 installed.
To upgrade it to latest, I renamed Xampp folder in c:// to "xampp_1" and took the group database backup in .sql format.
From this link, I downloaded php_oauth-1.2.3-5.6-ts-vc11-x86.zip and copied the php_oauth.dll to c://xampp/php/ext/ and then in php.ini, I mentioned extension=php_oauth.dll.
After this, I ran Apache server and Mysql through Xampp.
then tried to import the sql backup file through CLI as follows:
mysql -u root < localhost.sql
I got some error in command prompt. (I will update this soon)
Then later when I visited localhost/phpmyadmin, I am seeing this page:
In my case this worked:
logout
clear url (remove all after ?, wspecially token=blablabla must be removed)
remove all cookies
refresh
login
This can't fix the problem basically as the same error may appear in any time
Find php.ini in the xampp
1- post_max_size: 128M (give a size for example 128)
2- upload_max_filesize : 64M (for example 64)
post_max_size must be larger than upload_max_filesize to fix the problem.
Reason: You are getting this error because size of your filename.sql is greater than maximum upload limit. (By default you can import upto Max:2,048KiB)
Solution:
Navigate to xampp\php\php.ini
Find upload_max_filesize and increase it to desired upload side (e.g. upload_max_filesize=128M) and save
Restart xampp
Adding solution as a answer text so that the question drops from the Unanswered Questions list. Original answer is provided by the question author in a reply/comment on his original question text:
I uninstalled both 1.7.1 and 5.6.3 and then re-installed 5.6.3. That
did the trick.
The problem is with the Post Maximum size, open the PHP.ini file and find the
post_max_size=8M and increase it up to post_max_size=128M,
1.PHP.ini ->increase the post_max_size parameter from 8M up to 128M,
that's it.
I found a perfect solution in the following tool:
BigDump: Staggered MySQL Dump Importer
which allowed me to change the connection charset to match that of the dumpfile. Works fine without any installs/re-installs.
set this database and ini file
SET GLOBAL max_allowed_packet=1073741824;
max_allowed_packet = 64M
then: use CLI (cmd)
goto ->xamp->mysql->bin
copy the path n set in Cmd
use below command to dumb db
mysql.exe -u root -p db_name< "C:\Users\path\file.sql"
I have a setup with Directadmin, nginx and hhvm. I want to set memory_limit for every user through custom config files for hhvm. right now every user has a config file in the following directory.
/usr/local/directadmin/users/user/hhvm.ini
The memory_limit is set to me 128M, but when I check it through a php file with
echo ini_get("memory_limit");
I get the following output.
9223372036854775807
I have no idea where that number comes from. I do know that it is the biggest integer known for 64-bit systems. So how can i get the output to be 128M?
I found the answer. It was pretty stupid actually.
After an update the output from the memory_limit was what I set it to.
So in short it was a bug in hhvm.
I have a php script that need to be processed for one to 5 hours (sending newsletters to our customers). I tried both set_time_limit(2000); and ini_set('max_execution_time', 360000); but neither works. They work perfectly on the XAMPP local server, but they do not work on our dedicated server (Unix & Apache). I also changed the Apache timeout to 300 (which was 50), yet after 30 seconds of script running, it returns this:
Internal Server Error Page (Error 500)
I have no idea if there is any other place for timeout and/or why the server does not honor the ini_set() or set_time_limit() functions. We are using Unix CentOS 6 and Plesk 11.9 as server. I also changed the default php.ini max_execution_time, and it works...
I read many articles and forums, yet I don't know why this happens. I appreciate your help.
// add, in your php file header or config
ini_set('max_execution_time','256'); //max_execution_time','0' <- unlimited time
ini_set('memory_limit','512M');
Good work!
a better way would be using ini_set() or set_time_limit() at the top of the script which sends newsletters to the customers...you should not try to main config files...and also, as someone suggested above, cron jobs are good fit for such situations..
I appreciate your answers and comments. I setup the cron job, and it works perfect. I also have tried the chunk-chunk (150 emails per chunk) approach, and that one works too.
If you using Vps:
Edit your php.ini file:
max_execution_time = 256
memory_limit = 512M
Then, run command line to restart apache
service httpd restart
Or header file
ini_set('max_execution_time','256');
ini_set('memory_limit','512M');
Good luck!
I have a site which is hosted on a dev site for demonstration to the client, and everything works without problem. However, when I download the files and database to my local EasyPHP installation, I receive the following error:
Fatal error: Maximum execution time of
30 seconds exceeded in C:\Program
Files (x86)\EasyPHP-5.3.4.0\www\PC
Estimating\classes\database.class.php
on line 23
The database details for the connection are correct, as the Database object is already used on part of the template before this error is shown.
My question is, why does the system work fine on a live server, but not on EasyPHP?
You should check the max_execution_time setting in the php.ini files on your server and on your local installation.
btw... what is done in line 23 ?
Copied from my comment to make it easier to find the solution:
some things really runs slower on windows... while on mac/unix the php connects to mysql using a file socket while it should use tcpip in windows. Try using "127.0.0.1" instead of "localhost" when connecting to the db
These issue have two possible solutions:
1) Increase the max_execution_time in your php.ini . First of all, locate this file, and then edit it. Locate this line:
max_execution_time=30
and replace by:
max_execution_time=120
And then restart your webserver.
This will increase from 30 seconds to 120 seconds. You can increase even more, according to your application needs.
2) If this setting doesn't solve the problem, you may have to look into your PHP application, because there may be an infinite loop or something similar.
More details about this problem:
https://www.copahost.com/blog/increase-php-max-execution-time/
Because your PC is slow compared to server and/or your code is really badly optimised