Archive for the ‘Uncategorized’ Category

How to change the upload limit for an HTML form in PHP?

Friday, February 27th, 2009

I created an upload function for one of my scripts, and had a problem with the maximum size.So the steps to fix this situation are:

Change the .htaccess for the directory containing the upload script, adding the lines:

# Change upload setting to allow larger uploads
php_value upload_max_filesize 41M
php_value post_max_size 42M
php_value max_execution_time 400
php_value max_input_time 400

Important: the php_value post_max_size must be greater than php_value upload_max_filesize, since any upload will be part of the post variables.

In case you get an “Error 500: Internal server error” after placing the above lines in the .htaccess, it probably means that you server’s configuration is too restrictive.

Open your httpd.conf (or apache2.conf), look for a section such as

  ...
    AllowOverride Indexes AuthConfig Limit FileInfo
  ...
 
    Deny from all

and add “Options” to the allow override directive, as:

  AllowOverride Indexes AuthConfig Limit FileInfo Options

Also, if you don’t have it, add:

    Deny from all

to the same section. This will prevent the possibility of any file beginning with .ht* to be served o the browser, even if you forget to change it’s permissions.

Setting up a webserver with a ISP Control Panel

Sunday, February 1st, 2009

Setting up a webserver
I use to set my servers following the instructions from howtoforge, but there are a few missing settings due to my language:

Criando um “progress meter” com PHP 5.2 e APC

Monday, January 19th, 2009

Encontrei vários tutoriais sobre métodos de instalação de um progress meter a ser implementado em PHP. Como meu servidor roda Debian, aqui estão alguns passos necessários para a instalação:

Usando o APC (Alternative PHP Cache):

Instalar os pacotes necessários:

apt-get update
apt-get install apache-dev php4-dev

Instalar o pacote APC:

pecl install apc

Adicione as linhas ao seu php.ini (/etc/php5/apache2/php.ini)

extension=apc.so
apc.rfc1867 = 1

Nota importante: APC é incompatível com o Zend Optimizer, o que significa que o servidor não pode ser usando com vários pacotes comerciais que dependem do ZO…