Thursday, 5 May 2016

Some examples of using PHP CURL under various circumstances including cookies and callback's

https://curl.haxx.se/libcurl/php/examples/callbacks.html

Thursday, 5 November 2015

Enable Fast and unsecure Ciphers on Recent Versions of OpenSSH

When trying to use webdrive and turnkey lamp I couldn't connect over SFTP. It turns out this is because by default turnkey lamp 14.0 has secure ciphers and webdrive does not support these.
So I added this to /etc/ssh/sshd_config:
Ciphers 3des-cbc,blowfish-cbc,cast128-cbc,arcfour,arcfour128,arcfour256,aes128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com

Friday, 16 October 2015

How to change composers install path


If you need to install composer modules to a custom install path other than vendors, then add the following to your config substituting XXXX/XXXXX to the custom install path that you require.

"config": {
        "vendor-dir": "XXXX/XXXXX"

},

Thursday, 10 September 2015

Zend Server Optimizer+ cache problems

If Zend Optimizer is caching your files and new changes are not reflected when the code is running, in PHP you can call:

accelerator_reset()

This will clear the Optimizer cache.
http://files.zend.com/help/Zend-Server-5/zend_optimizer+_-_php_api.htm

Debugging PHP constants

Handy tip:
If you'r bodded down in old legacy PHP code and you need to know what constants are defined at any point during execution, simply call:

get_defined_constants(true)

You can either add this to Zend Debugger as an expression or error_log with print_r it.

Thursday, 27 November 2014

Listing running crontab tasks and killing them

  • ps -o pid,sess,cmd afx | grep -A20 "cron$"

3693  3693 /usr/sbin/cron
27050  3693  \_ /USR/SBIN/CRON
27055 27055      \_ /bin/sh -c /var/somescript
27058 27055          \_ /bin/sh -c /var/somescript
3706  3706 /usr/sbin/dovecot -c /etc/dovecot/dovecot.conf
3730  3706  \_ dovecot-auth
3737  3706  \_ dovecot-auth -w
902  3706  \_ imap-login
1339  3706  \_ imap-login
2398  3706  \_ pop3-login
2649  3706  \_ pop3-login
2837  3706  \_ pop3-login
2838  3706  \_ imap-login
3807  3807 pure-ftpd 


Find the process you want above 
  
  • pkill -s 27055

That's it.

Thursday, 25 September 2014

Password-less login over SSH

You can login to a remote Linux server without entering password using ssky-keygen and ssh-copy-id.

ssh-keygen creates the public and private keys. ssh-copy-id copies the local-host’s public key to the remote-host’s authorized_keys file.
ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys.

1, Create public and private keys using ssh-key-gen on local-host

me@local-host$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jsmith/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/jsmith/.ssh/id_rsa.
Your public key has been saved in /home/jsmith/.ssh/id_rsa.pub.
The key fingerprint is:
33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 jsmith@local-host
Step 2: Copy the public key to remote-host using ssh-copy-id

me@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
    me@remote-host's password:

Now try logging into the machine, with
ssh 'remote-host'"
 check in .ssh/authorized_keys

Login to remote-host without entering the password

me@local-host$ ssh remote-host
Last login: Sun Nov 15 12:22:33 2008 from 191.128.6.2

me@remote-host$   [Note: You are on remote-host here]