Autor

Aqui aparecem os posts dos autores selecionados.

Autor:Richardson Westphal

Criando arquivo CSV para download com php

Olá,

para criar o arquivo siga os seguintes passos:

1 – Crie as headers:

header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=data.csv');

2 – Crie e informe a saída:

$saida = fopen('php://output', 'w');

3 – Colocando as colunas:

fputcsv($saida, array('Coluna 1', 'Coluna 2', 'Coluna 3'));

4 – Obtendo os dados do Banco de dados:

mysql_connect('localhost', 'username', 'password');
mysql_select_db('database');
$linhas = mysql_query('SELECT campo1,campo2,campo3 FROM table');

5 – Inserindo o conteúdo no arquivo:

while ($linha = mysql_fetch_assoc($linhas)) fputcsv($output, $linha);

Bootstrap Tour, menu não abre corretamente

Olá,

Passei por esse problema recentemente e encontrei uma solução utilizando jQuery.

No passo anterior ao do menu coloquei assim:

onNext: function(tour){
 $('.dropdown ul').stop( true, true ).slideDown("fast");
}

Mas pode utilizar em qualquer uma das funções do step do tour.

Segue funcionando aqui: Jsfiddle

Apache Segmentation fault on configtest

Olá,

1 – O erro:

# /etc/init.d/apache2 start
 * Starting web server apache2
 * The apache2 configtest failed.
Output of config test was:
/usr/sbin/apache2ctl: line 138: 23872 Segmentation fault      $HTTPD ${APACHE_ARGUMENTS} -t
Action 'configtest' failed.
The Apache error log may have more information.

2 – Cheque os modulos de php instalados:

ls -1 /etc/apache2/mods-enabled/*php*

3 – Desabilite o que não irá utilizar, exemplo:

a2dismod php5

4 – Reiniciar o apache:

service apache2 restart

Instalando VSFTP

Olá,

1 – Instalar:

apt-get install vsftpd

2 – Configurar:

vim /etc/vsftpd.conf

3 – Criar pasta para o utilizador:

mkdir /home/user

4 – Criando ele no servidor:

useradd user

5 – Criando a senha para ele:

passwd user

6 – Reiniciar o servidor:

service vsftpd restart

 

Um arquivo já configurado com até o modo passivo ativo, ele está em txt vsftpd-conf.

Indexes travado em “processando” no Magento

Olá,

1 – No terminal do ubuntu digite:

php suapastamagento/html/shell/indexer.php -reindex catalog_product_attribute
php suapastamagento/html/shell/indexer.php -reindex catalogsearch_fulltext
php suapastamagento/html/shell/indexer.php -reindex catalog_category_flat
php suapastamagento/html/shell/indexer.php -reindex cataloginventory_stock
php suapastamagento/html/shell/indexer.php -reindex catalog_category_product
php suapastamagento/html/shell/indexer.php -reindex catalog_product_price
php suapastamagento/html/shell/indexer.php -reindex tag_summary
php suapastamagento/html/shell/indexer.php -reindex catalog_url

 

CUIDADO

Ao fazer isso todos os url_rewrite serão apagados e iniciados, qualquer um que tenha criado manualmente será apagado.