29 Apr

Amazon PHP SDK installation on Centos (via pear)

Installation of dependencies:

yum install php-channel-aws.noarch php-channel-guzzle.noarch php-symfony2-EventDispatcher.noarch

Installation of the library itself:

pear install aws/sdk

Checking:

[root@robo ~]# pear info aws/sdk
ABOUT PEAR.AMAZONWEBSERVICES.COM/SDK-2.2.1
==========================================
Release Type PEAR-style PHP-based Package
Name sdk
Channel pear.amazonwebservices.com
Summary Official PHP SDK for Amazon Web Services.
Description The AWS SDK for PHP enables PHP developers to
easily work with Amazon Web Services and build
scalable solutions with Amazon S3, Amazon
DynamoDB, Amazon Glacier, and more.
Maintainers Michael Dowling <[email protected]> (lead)
Jeremy Lindblom <[email protected]>
(developer)
Ryan Parman <[email protected]> (developer,
inactive)
Release Date 2013-03-18 17:30:25
Release Version 2.2.1 (stable)
API Version 2.2.1 (stable)
License Apache 2.0 (http://aws.amazon.com/apache2.0/)
Release Notes This release adds convenience features for the
Amazon S3 client, updates the Amazon RDS client
to use the latest API version, resolves an issue
with the Amazon EC2 client, and includes support
for additional regions and other enhancements.
Required Dependencies PHP version 5.3.3
PEAR installer version 1.4.0 or newer
Package guzzlephp.org/pear/Guzzle
Version 3.0.3 or newer
Extension curl
package.xml version 2.0
Last Modified 2013-04-16 16:10
Previous Installed - None -
Version
[root@robo ~]#

Getting list of installed files (there are a lot of them):

 pear list-files aws/sdk

Upd.
If it doesn’t work for you, try this way:

pear -D auto_discover=1 install pear.amazonwebservices.com/sdk
20 Apr

Fixing “selenium.common.exceptions.WebDriverException: Message: ‘Can\’t load the profile.”

Getting such error while using selenium with Python means that you most probably updated Firefox and didn’t selenium.

[dande@j ~]$ python zs.py
Traceback (most recent call last):
  File "zs.py", line 6, in <module>
    browser = webdriver.Firefox()
  File "/usr/lib/python2.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 58, in __init__
    self.binary, timeout),
  File "/usr/lib/python2.6/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "/usr/lib/python2.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 48, in launch_browser
    self._wait_until_connectable()
  File "/usr/lib/python2.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 95, in _wait_until_connectable
    self.profile.path, self._get_firefox_output()))
selenium.common.exceptions.WebDriverException: Message: 'Can\'t load the profile. Profile Dir: /tmp/tmpOGd4Im Firefox output: Xlib:  extension "RANDR" missing on displa
y ":1".\n*** LOG addons.xpi: startup\n*** LOG addons.xpi: checkForChanges\n*** LOG addons.xpi: No changes found\n'
[dande@j ~]$ 

Fixing:

[dante@j ~]# pip-python install -U selenium
Downloading/unpacking selenium
  Downloading selenium-2.32.0.tar.gz (2.5Mb): 2.5Mb downloaded
  Running setup.py egg_info for package selenium
Installing collected packages: selenium
  Found existing installation: selenium 2.30.0
    Uninstalling selenium:
      Successfully uninstalled selenium
  Running setup.py install for selenium
Successfully installed selenium
Cleaning up...
[dante@j ~]#

All set.

30 Mar

WordPress: getting summary from Login Security Solution plugin

Brute-force attacks are one the most common ones against WordPress sites. One of the possible solution is to use Login Security Solution plugin. It tracks attempts to login and ban IPs if there are too many of them during certain period of time. The plugin stores all information about the attempts in wp_login_security_solution_fail table. Here is how you can get summary on IP addresses which are attacking your site:

select ip, count(ip) as attempts from wp_login_security_solution_fail group by ip order by attempts desc;

Now you can block the most active of them in the firewall.

27 Mar

How to setup ionCube loader on Centos 6.4

If you need to install ionCube loader on Centos 6.4 you will need either to enable Atomic repository on your Linux box or to download their SRPM package and rebuild it.

Way 1

wget -q -O - http://www.atomicorp.com/installers/atomic |sh
yum install php-ioncube-loader

Way 2

rpm -ivh rpmbuild/RPMS/x86_64/php-ioncube-loader-4.2.2-2.art.x86_64.rpm
rpmbuild -bb ~/rpmbuild/SPECS/php-ioncube-loader-art.spec
rpm -ivh rpmbuild/RPMS/x86_64/php-ioncube-loader-4.2.2-2.art.x86_64.rpm

Checking:

[root@sched ~]# php -v
PHP 5.4.13 (cli) (built: Mar 14 2013 08:57:49)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd.
[root@sched ~]#