This is useful when I’m migrating data from one system to another. It uses the quotesplit code I talked about here: Parsing CSV data files with PHP, using quotesplit.
You want your source file to be tab delimited, with the header row containing the database field names that you are going to load each piece of data into. I use Excel to prepare the file. Then you run this file using the PHP interpreter at the console, and redirect t
How the Vagrant box is configured
To be able to step through code using the IDE of our choice, we need to install Xdebug onto our Vagrant Box.
Good instructions here: http://ubuntuforums.org/showthread.php?t=525257
Updates to the Provisioning Script:
Install php5-dev php-pear using apt-get, install xdebug using pecl, creating a properly owned folder in /var/log to store the xdebug log file.
Added to apt-get packages list:
php5-dev #needed for xdebug
php-pear #needed for
Say you want to test email sent from a PHP application on your development environment, and you don’t want to set up sendmail. You can write a little PHP script to replace the sendmail call!
First, create the following file: /usr/local/bin/phpsendmail
$logfile = '/data/www/ap/sent-mail.htm';
//* Get the email content
$log_output = "<p>****" . date('Y-m-d H:i:s') . "****</p>rn";
$handle = fopen('php://stdin', 'r');
$count = 0;
$buffer = trim(fgets($handle));
if ($count <= 12) #
The user grant syntax in mysql is problematic if you want to use a variable to set the hostname when you are creating users in a mysql script. The @ notation means the start of a variable normally, but it’s also used in the mysql grants… so if you try to do this:
GRANT SELECT, SHOW VIEW ON *.* TO 'username'@'@hostname' IDENTIFIED BY 'pass';
You get the error:
Lookup Error - MySQL Database Error: Malformed hostname (illegal symbol: '@')
Or if you take the single quotes out, y
I love having Control on the home row. To turn your (frankly useless and annoying) caps lock key into the ctrl key, browse to this key in regedit:
Set it to this Hex code:
OR use the registry modification files they made here: