Here is an interesting issue I ran into today while setting up a new VM. I had copied the Apache conf file and SSL/TLS certificate files onto my new server as root using wget. All of the file's ownerships and permissions looked right and I thought I was ready to go. Then I ran into these two misleading errors:
Could not open configuration file /etc/httpd/conf.d/ssl.conf: Permission denied
and
SSLCertificateFile: file '/etc/pki/tls/certs/mydomain.com.crt' does not exist or is empty
Contrary to what Apache reported, the ssl.conf file did have the correct permissions and the crt file did exist and had contents. So what gives? Our trusty SELinux friend is at it again, it seems. Because I had copied these files in from somewhere else, SELinux was detecting something off. It is an easy fix, though. Just run this command, specifing each of the files above:
restorecon -v /etc/httpd/conf.d/ssl.conf
and
restorecon -Rv /etc/pki/tls/certs/
That -R is for "recursive" and it means I want it to do the whole directory.
After fixing up the SELinux permissions for these files I brought in, everything started up just fine!
Saturday, June 15, 2013
Monday, May 27, 2013
Using SQLite for Unit Testing in PHP
Unit testing is infamous when one attempts to test database-interacting classes. I noted that some had suggested using SQLite when running phpunit to test these sorts of classes. Been working for me, so I thought I'd jot it down here.
First, make sure sqlite3 is installed. On Ubuntu you'd run the following at the command prompt (assuming this step is necessary, but now I'm not quite sure):
And then, in the part of your PHP script where you set up PDO (if that's the class you use, as I do), you can specify sqlite's in-memory DB:
First, make sure sqlite3 is installed. On Ubuntu you'd run the following at the command prompt (assuming this step is necessary, but now I'm not quite sure):
sudo apt-get install sqlite3 libsqlite3-dev
Next, make sure PHP support for sqlite3 is installed enter this at the command prompt:
sudo apt-get install php5-sqlite
And then, in the part of your PHP script where you set up PDO (if that's the class you use, as I do), you can specify sqlite's in-memory DB:
$conn = new PDO('sqlite::memory');
Thursday, April 25, 2013
Non-Profit Merchant Account Tips
I feel like I've been around the block with merchant accounts. This is especially true for non-profits and online donations – I've been working in this field for a number of years. If you want to accept donations online and you want to do it without giving PayPal a big chunk of it, merchant accounts are the way to go. You'll need a platform or a good programmer, but those are pretty easy to come by these days (wink, wink).
If you're a non-profit the risk you pose to the financial world is low giving you a little leverage when securing a merchant account. Here are few tips for those who are looking:
If you're a non-profit the risk you pose to the financial world is low giving you a little leverage when securing a merchant account. Here are few tips for those who are looking:
- Say 'no thanks' to contracts - The merchant service provider doesn't really need you to sign a contract. They just don't want you to leave and who can't blame them, that's how they make money. But you don't need no stinkin' contract. There is too many providers who will give you a good deal on a merchant account without one. Plus, you need an out if they decided to raise their prices on you one day (which happens, sometimes without warning).
- Opt for 'interchange plus' pricing - There are a few pricing options out there. Interchange plus usually ends up being the best deal because they give you wholesale rates plus a little overhead added on. In this case, if a donor uses a debit card that has a really low discount rate (say 0.5%, thanks to the Durbin amendment) then your saving a ton of money. Other common, not-as-good options include 'tiered' and 'ERR' pricing. You might say that tiered pricing is credit card processor lingo for 'round it up and I'll keep the change' and ERR pricing is synonymous for 'round it up and add some extra just in case'.
- Ask for an itemized list of fees - The merchant world is all about fees, fees and more fees. And merchant service providers, generally speaking, do their best to hide fees. They do this so often that even when they're trying to be transparent, they're still hiding fees. It is really crazy and one of the few industries that can somehow get away with it (not sure why that is). When you get a merchant account quote, tell them you want to know about them all: gateway fees, statement fees, PCI compliance fees, IRS fees, Visa/MC fees, AMEX fees, discount rates, per-transaction fees, per-auth fees, batching/settlement fees, .... everything!
Hope this helps and if you have any questions, reply below.
Wednesday, October 17, 2012
Installing Multi-Byte PHP Functions
I received this error today:
Fatal error: Call to undefined function mb_strlen()
And it would look the same, no matter what multi-byte PHP function I might be using: mb_strpos(), mb_substr(), etc. And it is beginning to be important to have this extensions installed if you are working with international, multi-byte character sets like UTF-8.
The fix is super easy. All you need to do is install the PHP multi-byte extension with yum (if you're on CentOS or RHEL). Do the following from the command line:
yum install php-mbstring
service httpd restart
That installs the extension and restarts Apache. Then you're good to go!
Fatal error: Call to undefined function mb_strlen()
And it would look the same, no matter what multi-byte PHP function I might be using: mb_strpos(), mb_substr(), etc. And it is beginning to be important to have this extensions installed if you are working with international, multi-byte character sets like UTF-8.
The fix is super easy. All you need to do is install the PHP multi-byte extension with yum (if you're on CentOS or RHEL). Do the following from the command line:
yum install php-mbstring
service httpd restart
That installs the extension and restarts Apache. Then you're good to go!
Thursday, September 20, 2012
MacBook Pro Retina & Linksys Routers
I have two Linksys wireless routers (WRT160N and E1200). One at an office, the other at home. I bought a MacBook Pro Retina a couple days ago (OS v10.8.1). I've now found that my new MBP doesn't play nice with Linksys.
Typically what happens is that, while still connected (according to the status bar), the connection chokes for about 30 seconds -- nothing flows through the pipes. What is even crazier is that it does the same for everyone else on the network (Macs and PCs).
This doesn't happen at Starbucks or the Apple store (which I am pretty sure don't use Linksys routers).
I can't find anything online about this so I'm asking the question: Has any one else had any issues with the MBP or rMBP on Linksys routers?
PS. The routers do have the latest firmware.
Typically what happens is that, while still connected (according to the status bar), the connection chokes for about 30 seconds -- nothing flows through the pipes. What is even crazier is that it does the same for everyone else on the network (Macs and PCs).
This doesn't happen at Starbucks or the Apple store (which I am pretty sure don't use Linksys routers).
I can't find anything online about this so I'm asking the question: Has any one else had any issues with the MBP or rMBP on Linksys routers?
PS. The routers do have the latest firmware.
Saturday, June 16, 2012
Installing Memcached on CentOS
I have a web server running CentOS and wanted to get some good caching going for PHP use. This is how I installed memcached, from the command line:
- Install memcached
- yum install memcached
- Install Pecl (if you don't yet have it, installing pear installs pecl)
- yum install php-pear
- Install Pecl's Memcached package (for PHP)
- Install dependencies, as needed
- yum install php-devel
- yum install gcc
- yum install zlib-devel
- pecl install memcache
- Use a text editor to add "extension=memcache.so" to php.ini (may be in the /etc folder)
- Restart the service
- service memcached start
- service httpd restart
And when you want some raw stats, you can get them via telnet:
- telnet localhost 11211
And type "stats" to see hits, misses and more!
Tuesday, April 10, 2012
iPad POS List
I did some research a while back and compiled a list of Point of Sale (POS) systems that function on the iPad (and some on the iPhone, too). It is strangely harder than you'd think to find a complete list, like this. So, here they are, in no particular order:
Subscribe to:
Posts (Atom)