Friday, August 28, 2015

New GIT Repository -> BitBucket -> Windows

Just added my WordPress code to a Bitbucket Git repository. As always when I want to init a new project, I first head over to gitignore.io to quickly get a decent .gitignore file. If you use the service, and your starting from Linux, the tutorial video is worth watching before you start.

After setting up the .gitignore file, in Linux, the following will create your repository...

sudo git init
sudo git add .
sudo git commit -m 'initial commit'

After that, create a new empty repository in Bitbucket, select the "I have an existing project" link, and follow the instructions to your new repository on Linux added to the empty repository on Bitbucket.

Sidenote: when I switched from Mercurial to Git (Mercurial was fine for me... just wanted to get my feet wet with Git), my idea was to use GitHub. However, being in a startup, with a small team, I decided to keep some Euros in my bank account and use Bitbucket, which is free for up to 5 users. I used Bitbucket with Mercurial, so I was already familiar with it, and I'm very happy to stay there.

Next, since I develop on Windows (10), I needed to get the code locally. To do that, I use SourceTree, which makes cloning the repository on Windows a no-brainer.

Friday, August 21, 2015

Quickly Toggle MySQL Logging

MySQL logging is a lifesaver when trying to understand applications at a low level. However, since I use it infrequently, I always have to consult the Google doc I have with the details on how to toggle the setting, and where to find the output.

For Windows, I've switched to a BAT file to speed up the process (which I call from SlickRun).

@echo off
set /p state="Set MySQL Logging state ON or OFF: "
c:\xampp\mysql\bin\mysql -u "root" -e "SET GLOBAL general_log = '%state%';
%SystemRoot%\explorer.exe "C:\xampp\mysql\data"

Wednesday, August 12, 2015

AWS S3, PHP, XAMPP, and cURL error 60

Due to problems with VirtualBox and Vagrant on Windows 10, I've temporarily moved back to XAMPP for local development. While restoring the backed up databases to my local MySQL, I hit a cURL error 60.

The correct response to this problem was to download a CA Bundle and tell PHP to use it in the php.ini file, e.g.

[curl]
curl.cainfo="C:\xampp\php\extras\ssl\cacert.pem"

However, even after downloading a pem file from http://curl.haxx.se/docs/caextract.html, setting the above, and restarting apache, I was still getting the same error. Since I'm using a phar file for the AWS SDK, debugging the problem was difficult.

A post by GeoffGordon finally solved this for me... downloading a zip file of the pem, and then using the extracted version, fixed this for me. Thanks, Geoff!

--------------------

When using WampServer, I had the same problem, with a different cause. The php.ini file indicated by a php file served from my local server was different than the php.ini file being used by PHPStorm for debugging. I extracted the php.ini used by PHPStorm by debugging a file with the following code.

<?php
ob_start();
phpinfo();
$phpinfo = ob_get_contents();