The below PHP generates a cachefile used to display a GIT changelog.
(Because I didn’t have the power to get GIT installed onto the production server…)


$cachedir = "./cache/";
$cachefile = $cachedir . 'gitlog.txt'; 

if ( 'TRUE' == $devServer) {
	// check to see if cache directory exists - if not - make it
	if (!is_dir("$cachedir")) {
		mkdir("$cachedir", 0777, true); 

	// Start the output buffer

	// Use git log to display...(//
	echo shell_exec('git log --pretty=format:"<hr><p><small><code>%h</code> %n%an, %ad</small></p><h4>%s</h4><pre>%b</pre>"');
	// Now the script has run, generate a new cache file
	$fp = @fopen($cachefile, 'w'); 
	// save the contents of output buffer to the file
	@fwrite($fp, ob_get_contents());
	// Clean out the buffer

echo file_get_contents("$cachefile");


If the following simple script in your repo directory doesn’t do it you may need to explicitly add git to you PATH. Even if it’s installed and running fine – PHP may not be able to find it.

Jump into Terminal sudo ln -s /usr/local/git/bin/git /usr/bin/git!topic/symfony2/kF3aQ3ZWb88

Alternatively you may want to try this simple trick to reinstall command line tools using Xcode and see it that works (Xcode -> Preferences -> Downloads -> Command Line Tools -> Install)

Alternative issue that causes blank output:

Last updated on 5th September 2018