There is no particular secrets. This is just a reminder for myself.
So, you need to change 3 lines in your php.ini to increase maximum upload file size.
upload_max_filesize controls maximum upload file size indeed.
But you also must change post_max_size which controls POST data maximum size. File transfer uses POST, you know.
max_execution_time controls maximum execution time of php-script on server. If file would upload longer than maximum script execution time, than upload will be interrupted.
You can apply all changes with global php.ini. But your hoster never give you access to global php.ini (until you have dedicated server or VDS). Usually you have crappy upload limit of 2MB, severe system administer and absolutely no access to global php.ini. But there are other solutions.
Your hosting may allow to use custom php.ini located in your web-site home directory. You can check it out with php_info(). Look for Configuration file (php.ini) path. If it's allowed than create php.ini at your web-site folder and add necessary lines there.
Another solution is to add necessary lines into .htaccess. There is a way to do:
<IfModule mod_php5.c> ... php_value upload_max_filesize 200M php_value post_max_size 200M php_value max_execution_time = 3600 ... </IfModule>
Or you can use ini_set() function of php itself. For example with Drupal you can edit /sites/default/settings.php and add:
Since I’m making statistics engine for Internet-radio ct.fm I have opportunity to play about huge selections and table optiomization.
So, here is a table where all information about channel connections is gathered: ip-address, time of connection, disconnection, conjectural geographical location of user, etc.
create table ctfmstat_log( lid bigint unsigned primary key auto_increment, ip int, start int, end int, countrycode varchar(20), countryname varchar(40), region varchar(40), city varchar(40), latitude float, longitude float ) DEFAULT CHARSET=utf8;
Typical query to such table is something like “how many users has connected to channel at day n”.
SELECT DATE_FORMAT(FROM_UNIXTIME(start),"%Y%m%d") as day, count(*) as counter FROM ctfmstat_log WHERE start>1257026400 AND start<1262296800 GROUP BY day ORDER BY day;
I’ve used simple php-code(I don’t bring it here, not so important) that run such query cyclically 10 seconds.
Result: 80-90 fetches
So, let’s change table a little…
create table ctfmstat_log( lid bigint unsigned primary key auto_increment, ip int, start int, end int, countrycode varchar(20), countryname varchar(40), region varchar(40), city varchar(40), latitude float, longitude float, index (start) ) DEFAULT CHARSET=utf8;
Fill the difference!
I have been asked to make a statistics generator. I've been told I can make it any way I want. Perl, php, php+flex – they doesn’t matter. The main essential feature is ablity to print reports and save them in pdf, or in excel, what is more preffered. I would like to make it with flex so much, couse it has cool graphics components and cause I need practice in flex also. But in php I have great option in how data can be saved to pdf or xls. To save data in pdf I can use pdflib, fpdf, html2pdf. To save data in excel I there are PEAR::Spreadsheet_Excel_Writer and wonderful PHPExcel as people says. I’m sure there will be some troubles with Russian codepages, some minor bugs, but work will be done. And so to flash I don’t have so much choice. All I have is AlivePDF. Well, I have to try. In the worst case I can send data from flash to php and generate report at server.