odd power supply issue

My machine crashed again last night. It’s a Mac Pro and is connected to a battery backup that then goes to wall power. Last night, I heard the battery backup emit one beep, then shut everything down connected to it. I was running late and it was the end of the day, so I let it go to review in the morning.

Next morning, I can’t get the tower to boot. I disconnect it from the battery and try again with the same result. I disconnect it from the wall and start a support ticket. A few hours later, support comes by and the machine boots up. Their guess is that the capacitors inside the power supply need to discharge completely to avoid interference in the boot process. I’ve never heard of this before, but I do know that Apple has had capacitor problems in the past. This behavior matches what happened in the summer. Machine failed to start after shutdown. Machine was eventually disconnected from wall power. Machine boots again.

Very strange behavior, but I may be forced to disconnect the power if this keeps happening. I’ll need another machine, but I don’t expect one from work, due to other issues. I’ll figure something out.

odd home-brew issue with permissions,

I was going to update files installed through home brew and I noticed an odd error message:

Error: unable to unlink old ‘share/man/man1/brew.1’ (Permission denied)

or something like that. That’s never happened before. /usr/local should not have a permissions problem, unless MySQL is involved somehow. (B’). I run ‘brew doctor’ on the command line and it suggests permission fixes for /usr/local/bin/, /usr/local/share, /usr/local/share/man and /usr/local/share/man/man (?). Why did this happen?

I know that “rootless” access is being enabled in OS X 10.11, El Capitan. The idea is this “System Integrity Protection” will make it difficult for malware to install itself in /System, /bin, /sbin, and /usr. However, /usr/local was supposed to be left alone. Also, I’m running Yosemite, not El Cap. Even so, I need to run my updates, so I run the following in Terminal

sudo chown -R “$USER”:admin /usr/local/bin

sudo chown -R “$USER”:admin /usr/local/share

When I run “brew update” again, my system is ready for brewing.

From what I can tell, it looks like folder permissions may be reset during each system software update. I can’t confirm it, but it makes sense. If I had problems after a system update, I would run the Disk Utility and have it repair permissions. Usually, whatever problem I had would go away. It looks like OS X wants to be helpful, but also interferes with the way I have things set up. I’ll make it work.

reloading files … not fun

My workstation has a weird short circuit somewhere that has to be tracked down at the help desk. While I wait, I’ve tried to install my work on the department laptop. It has not been easy.

Luckily I pushed copies of what I was working into repositories for off-site storage. Unfortunately, those repositories were slightly out of date. I did not lose anything from the database archives, from what I can tell. The CakePHP 3 repo is about two weeks out of date. I convinced myself it was OK, since I spent two weeks trying to solve a dead end regarding JQuery, AJAX and calls back to the original CakePHP action. It should be easy, but I have not been able to track down the answer yet.

I cloned the archive repository locally and reloaded that SQL into the local copy of MySQL. That went fine, with some minor issues. You can’t load a table with foreign keys until after those related tables are loaded first. (Of course.) If the file is too big to load through phpMyAdmin’s 2 MB file limit, zip it and try again. (That answer was staring at me all day long. Very annoying, once I found it.) Everything looks fine, so I move on to the next action.

Next, I needed to reload the CakePHP repository. Installing CakePHP is a little more involved than cloning a repository. For starters, the docs say I need Composer to install, which is not loaded on the laptop. I’m not sure why that would be needed for a repository clone, but why not? It can’t hurt, and I might need it, so I load Composer using homebrew. I found my old instructions for installing composer, but I forgot the final instruction, about ignore dependencies. I’m sure I thought it was obvious at the time, but it’s better if I remember putting it in. Finally, Composer is loaded, updated and ready to go.

Next, I remember that CakePHP needs specific PHP extensions to run properly (mbstring, openssl, and intl). The one I did not have was the intl extension. I checked my notes again and found a very good description of how to install the intl extension. That’s done, finally. I’m ready for CakePHP.

I clone the CakePHP repository. When I try to load it, it bombs. I get an error about permissions denied in the logs folder. I remember this error from another installation, so I’m confident I can track down the issue. I also notice that the vendors directory is empty. Now that I have the composer.json file, I update Composer and run it again. The vendors directory is back, but I still have the permissions problem.

While checking the vendors directory, I went to the config directory for some reason. I noticed that my config/app.php file is missing. That’s odd. The app.php file controls database access, so I’m surprised to see it’s missing. I finally get access to the Time Machine drive of the old machine and copy the latest version of that app.php file over. The permissions problem is not solved, so I decide to start from the basic installation with a test site described on the CakePHP web pages.

I stumble around, comparing user/group settings on folders between the fresh install and the Time Machine backup. Eventually, I get them set to something that looks like it works. However, the links to the CakePHP css pages are not working. I remember this again from a previous install. This has to do with apache and how it blocks access to .htaccess files (or something like that.)

I track down the section in the CakePHP documentation regarding URL rewriting, so I figure out how to set apache properly to get it to read CakePHP’s .htaccess file. While there, I find a related link that tells me exactly how to fix the logs and tmp directory. I’m almost ready, except for the part where my archives have disappeared. Somehow, they tables I loaded disappeared at some point. Very strange. This is important since I built a small website that uses CakePHP to display the data in the archive tables. Next stop. What happened to the archive tables?

More composer notes

When I decided to investigate PHP frameworks, I discovered that lots of them required Composer  (https://getcomposer.org) for full installation. It makes sense, since Composer is a “dependency manager for PHP” and serves to collect everything needed for a PHP application. I like the idea of having something that can install everything needed at once, so I decided to install it.

I use Homebrew (http://brew.sh) as my package manager, so I had it install composer as a global package. It installed composer 1.0.0-alpha9. As described in another post, I ran into some problems installing CakePHP that were eventually resolved, more or less. I still had some trouble using Composer to install CakePHP, but I did get the pieces to install using a full CakePHP download from their site (http://cakephp.org). I was a little disappointed that Composer did not work as expected, but I got what I needed, so I moved on.

Eventually, I became comfortable enough with Bootstrap to install a Bootstrap plugin into CakePHP. The plugin instructions said to update the CakePHP composer.json file and then update it. I tried that, but I had trouble with parsing of a composer package version: “>=0.4.2 <1.0”. It looks fine, but my copy of Composer stopped over and over again. I installed a new local copy of composer and ran a dry run to see what would happen. This time, there were no freezes. I don’t like the idea of having local copies of composer sprinkled throughout the file system, so I did more research.

I tried using brew to update the composer package, but it would stop with errors. The error messages mentioned I did not have a copies of PHP in the brew directories. That’s true. I did not want to install additional copies of PHP when Apple provided an slightly order, but working copy. I managed to install composer before, but the trick I used then did not work now.

After reading the documentation (who does that?), I discovered that I could get composer to update itself. After running the self update, composer finally updated itself to the latest stable version. The syntax issue that caused problems before was fixed. I was able to update CakePHP to 3.0.5 and also successfully installed the Bootstrap plugin. On to the next issue.