How to , and other stuff about linux, photo, php … Another blog just like others on internet

May 29, 2017

How to install git composer globally

Filed under: Linux,Php — Tags: , , — admin @ 10:28 am

Hello

The easy way to install composer globally is to run bellow commands


curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

April 25, 2017

how to disable gzip for specific file

Filed under: Linux,Php — Tags: , , , , , , — admin @ 1:33 pm

The short answer is

RewriteRule ^dashboard/index - [E=no-gzip:1]
SetEnvIf REDIRECT_no-gzip 1 no-gzip

Some explination of that solution

The – means NOOP, E means set variable, 1 is the value. After redirects, the variables are renamed and prepended with REDIRECT_.

This work for php FPM

If you have a mod dso you can use also this

apache_setenv('no-gzip', '1');

January 11, 2017

php 5.6 ssl verify error

Filed under: Linux — Tags: , , — admin @ 12:15 pm

New problem in town . A server could not send e-mail using php . But can connect using telnet .
stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:#012error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Some error from php class.
Well it appear that there is no cert on server
php -r “print_r(openssl_get_cert_locations());”

Array
(
[default_cert_file] => /etc/pki/tls/cert.pem
[default_cert_file_env] => SSL_CERT_FILE
[default_cert_dir] => /etc/pki/tls/certs
[default_cert_dir_env] => SSL_CERT_DIR
[default_private_dir] => /etc/pki/tls/private
[default_default_cert_area] => /etc/pki/tls
[ini_cafile] =>
[ini_capath] =>
)

For me this file was not there
/etc/pki/tls/cert.pem
After I run
update-ca-trust
I have copy the file
/etc/pki/tls/certs/ca-bundle.crt to /etc/pki/tls/cert.pem and it worked .

 

UPDATE

Today facing same problem but more complicated. The cer.pem was there ..but mail was not sending . So how to debug it ?

Well first of all we need to see what root certificat is needed.

So I run

openssl s_client -crlf -connect mail.domain.com:465

depth=0 C = EN, CN = mail.domain.com
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 C = EN, CN = mail.domain.com
verify error:num=21:unable to verify the first certificate
verify return:1

….


subject=/C=EN/CN=mail.domain.com
issuer=/C=IL/O=StartCom Ltd./OU=StartCom Certification Authority/CN=StartCom Class 1 DV Server CA

No client certificate CA names sent

 

From here we see that we need StartCom Class 1 DV Server CA

So I search on google and find it here

https://www.startssl.com/root

So I download the CA pem file into /etc/pki/ca-trust/source/anchors/

and after this run also

update-ca-trust extract

After this all was working fine.

 

 

More information can be found here

Trusting additional CAs in Fedora / RHEL / CentOS: an alternative to editing /etc/pki/tls/certs/ca-bundle.crt (or /etc/pki/tls/cert.pem)

and here

http://kb.kerio.com/product/kerio-connect/server-configuration/ssl-certificates/adding-trusted-root-certificates-to-the-server-1605.html

February 17, 2014

Compare two version of php.ini after move server

Filed under: Linux — Tags: , , , — admin @ 10:48 am

Well, after install and move one server to other one problem is to keep same information in php.ini . However I don’t think is ok just to copy and replace them, so a compare script should be run.

So I found one , and improve it a little.
cat comparephpini.php
$val ) {
if( $val == $c2[$key] ) continue;
echo $key.': '.$c1[$key].' // '.$c2[$key]."\n";
}

foreach( $c2 as $key => $val ) {
if( $val == $c1[$key] ) continue;
echo $key.': '.$c2[$key].' // '.$c1[$key]."\n";
}

August 13, 2012

Failed to download pecl/ssh2 within preferred state “stable”, latest release is version 0.11.3

Filed under: Linux — Tags: , , , , — admin @ 11:49 am

Today I was trying to upgrade a php on centos 5.4 from php 5.2 to php 5.3
The upgrade was run using

rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
yum --enablerepo=webtatic update php

Well everythins was ok, however after upgrade I see that if I run php -v i got some errors, memcache and ssh2 was installed using pecl and they should be reinstalled.
Well the pecl install memcache work well however
pecl install ssh2
return this error
Failed to download pecl/ssh2 within preferred state “stable”, latest release is version 0.11.3,

Well I did manage to install it by using
pecl install “channel://pecl.php.net/ssh2-0.11.3”

Regards

Older Posts »

Powered by WordPress