terça-feira, 11 de dezembro de 2012

Ubuntu instalando OCI8 para rodar no PHP

sudo apt-get install build-essential
sudo apt-get install php5-dev php-pear libaio1

Then download the Oracle Instant Client from Oracle (you will need to create an account).
You will need the Basic (58MB) and SDK (600K) -- baixe as versões ZIP. The Basic Lite version does not work.
Vc precisará saber se seu servidor é AMD ou Intel e se é 32 ou 64 bits, clique aqui para conferir os comandos
crie a pasta lib se ela não existir
cd /usr/local/lib
sudo unzip <location-of-instant-client-basic>
sudo unzip <location-of-instant-client-sdk>
cd instantclient_11_2
sudo ln -s libclntsh.so.11.1 libclntsh.so
renomeie a pasta  instantclient_11_2
mv instantclient_11_2 instantclient

The symbolic link is needed during the compilation step later.
sudo pecl install oci8

You will be prompted for the location of the library:

no meu caso eu apenas dei [enter] para ele localizar automaticamente, da maneira acima não funcionou.

PHP5 Instructions

You should now create a new oci8.ini file which will be included when loading php.ini (Editing the php.ini is discouraged):
nano /etc/php5/conf.d/oci8.ini

this will create a blank file; add to this file:

Confira a instalação rodando phpinfo() no servidor.

segunda-feira, 10 de dezembro de 2012

MySQL select a partir de

No select abaixo teremos emails a partir da letra G

SELECT email, id
WHERE LOWER( LEFT( email, 1 ) ) NOT
IN (

'a', 'b', 'c', 'd', 'e', 'f'
ORDER BY email

Aki apenas letras:

SELECT `empresa`
WHERE empresa NOT
REGEXP '^[0-9]+$'

E aki apenas numeros:

SELECT * FROM table WHERE columnName REGEXP '^[0-9]+$'

sábado, 8 de dezembro de 2012

Exim4 configuração

Arquivo update.conf:

dc_eximconfig_configtype='smarthost' # veja as configurações detalhadas abaixo
dc_relay_nets='COLOQUE AQUI SEUS IPS'
dc_smarthost='COLOQUE AQUI SEU SMARTHOST' # se vc não souber pergunte para o seu provedor de acesso (é o servidor de smtp do seu provedor)

Geralmente o "problema" esta nesta variavel dc_eximconfig_configtype em caso de duvida pergunte ao seu provedor de acesso qual deve usar.

Não esquecer de mudar:

de www-data para o e-mail desejado:
vi /etc/email-addresses

hostname desejado
vi /etc/hosts
vi /etc/hostname

Não esquecer de tirar totalmente o sendmail:
sudo apt-get --purge remove sendmail-base sendmail-cf sendmail-doc

Descrição das variaveis acima:

The octal file mode of the generated file.
The main configuration type. One of internet, smarthost, satellite, local, exim3manual or none.
Boolean option that controls whether the local mailname in the headers of outgoing mail should be hidden. (Only effective for smarthost and satellite.
Internal use only Boolean option that is set by the maintainer scripts after adding the contents of /etc/mailname to the dc_other_hostnames list. This is a transition helper since it wouldn't otherwise be possible to see whether that domain name has been removed from dc_other_hostnames on purpose.
Boolean option that controls whether update-exim4.conf strips the comments from the target configuration file (default) or leaves them in. This can be overridden by the command line options --keepcomments and --removecomments.
name of the default transport for local mail delivery. Defaults to mail_spool if unset, use maildir_home for delivery to ~/Maildir/. This setting does not correspond to a Debconf question and needs to be set manually.
Used as the value for Exim's main configuration option local_interfaces.
Boolean option to activate some option to minimize DNS lookups, if set to true a macro DC_minimaldns is defined.
is used to build the local_domains hostlist, together with localhost. This is the list of domains for which this machine should consider itself the final destination.
For smarthost and satellite it is possible to hide the local mailname in the headers of outgoing mail and replace it with this value instead, using rewriting.
is used to populate the relay_to_domains domainlist, a list of domains for which we accept mail from anywhere on the Internet but which are not delvered locally, e.g. because this machine serves as secondary MX for these domains.
A list of machines (hostlist) for which we serve as smarthost. Used to populate the relay_from_hosts hostlist. Please note that in the default configuration, and ::::1 are always permitted to relay since /usr/lib/sendmail is available anyway and relay control doesn't make sense here.
List of hosts to which all outgoing mail is passed to and that takes care of delivering it. Multiple hosts are colon separated. Each of the hosts is tried, in the order specified (See exim specification, chapter 20.5). All deliveries go out to TCP port 25. Specifying different ports is not (yet) possible due to upstream restrictions. Used as value of the DCsmarthost macro.
Boolean option that controls whether update-exim4.conf uses /etc/exim4/exim4.conf.template (false) or the multiple files below /etc/exim4/conf.d (true) as input.