Extensao de Arquivo em PHP

<?php

echo pathinfo('arquivo.jpg', PATHINFO_EXTENSION);

?>
CategoriasPHP

REINICIA APACHE EM SERVIDOR COM POUCA MEMORIA

#!/bin/bash
# REINICIA APACHE SE SERVIDOR ESTIVER COM POUCA MEMORIA

MEMORIA_MAXIMA_EM_USO=400
FILE=/var/log/gerencia_memoria.log

while :
do

  MEMORIA_EM_USO=`free -m | awk '{print $3}' | head -n 2 | tail -n 1`

  if [ $MEMORIA_EM_USO -gt $MEMORIA_MAXIMA_EM_USO ]; then

    MEMORIA_LIVRE=`free -m | awk '{print $4}' | head -n 2 | tail -n 1`
    /etc/init.d/apache2 restart &> /dev/null
    echo "[ `date +%H:%M:%S` ] - POUCA MEMORIA ( $MEMORIA_LIVRE )" >> $FILE

  fi

  sleep 10
done
CategoriasShell Script

Alterar senha de usuário MySQL

1 – Logue no banco de dados como root

$ mysql -u root -p

2 – Altere a senha do usuário

mysql> USE mysql;

mysql> UPDATE user SET Password=PASSWORD(’123456′) WHERE User=’nickollas’;

mysql> FLUSH PRIVILEGES;

 

CategoriasMySQL

PHP abrir outro PHP no Windows

<?php

  pclose( popen( "start C:\\outro_script.php", "r" ) );

?>
CategoriasPHP

Imprimir Objetos em Perl

use Data::Dumper;

print Dumper( $objeto );
CategoriasDebian 6.0 Squeeze

Acesso Remoto MySQL

1 – Comtente a entrada abaixo no arquivo /etc/mysql/my.cnf

[root]# vi /etc/mysql/my.cnf

bind-address           = 127.0.0.1

2 – Reinicie o MySQL

[root]# /etc/init.d/mysql restart

3 – Permita acesso do usuário remotamente ao servidor MySQL

[root]# mysql -u root -p

GRANT ALL ON *.* TO ‘root’@'%’ IDENTIFIED BY ‘suasenha’;

CategoriasMySQL

Acessar CUPS de qualquer maquina

Subtitua a entrada “Listen localhost:631″ em /etc/cups/cupsd.conf por:

Port 631

Adicione o parametro “Allow form all” para as seguintes entradas:

<Location />
Order allow,deny
Allow from all
</Location>

<Location /admin>
Order allow,deny
Allow from all
</Location>

<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow from all
</Location>

CategoriasDebian 6.0 Squeeze
Seguir

Obtenha todo post novo entregue na sua caixa de entrada.