I had just set up a Poedit for a project at work and was trying to update the *.po file with new translations. It wasn’t finding a whole load of them.
After a while of poking around, it dawned on me that it was not looking in my phtml files. Simple enough, I just added *.phtml to the list of extensions in the parsers preference.
Then I receive a big long error message that xgettext didn’t know what phtml.
Solution
Add pthtml to your list of extensions
*.php;*.phtml
You also need to add ” -L php” to the end of your Parser command
xgettext --force-po -o %o %C %K %F -L php
Should you upgrade to OS X Lion??? Meh…. it’s presented more problems than previous upgrades.
Maybe I should have waited until 10.7.1, so this is my punishment for being bleeding edge.
Another issue I saw was the continual nag when I opened some apps (Billings and Cyberduck) that “This program was downloaded from the Internet… blah blah blah” This normally happens once for a program then goes away after you say “OK”, but this was happening everytime I opened those two programs.
I took the plunge on Monday and upgraded to Lion. I know better than to do an OS upgrade while I have a mountain of work on my plate, but oh well.
The upgrade itself was the easiest ever. Just buy it, download it, then it takes about 30 minutes to install. Done.
What I like
The interface is cleaner
Mission control (aka Expose et. al) is a bit better
Full screen is nice.
Local Time Machine backups are nice
What I don’t like
The scrolling. I tried it for a whole day, but it doesn’t feel natural at all, so I reverted back to the original scrolling direction.
Finder got rid of my “Macintosh HD” in the side bar. I’m sure I can get it back, but I need to go to the root directory once in a while. it was nice having it there.
It seems slower than Snow Leopard. Seems like my machine is running at a warmer than normal and slower than normal rate.
What broke
I was using Zend Server CE as my local web / mysql server. That was utterly broken. Instead of just reinstalling right away I tried out the local web server following this write up by Rob Allen
Worked good, but it seemed really slow (more on that below).
So because of this apparent slowness I installed MAMP. It installed fine, but MAMP had problems resolving host names and doing network calls… Someone said it was a bug in the PHP version that MAMP ships. Anyway, it didn’t solve the speed problem either (that should have been my first clue).
I looked into installing Nginx on Mac, but didn’t have ‘make’ installed so I’ll have to pass for now.
I redownloaded Zend Server CE and installed that. Worked fine, but it was still slow.
Chrome is to blame
I use the local /etc/hosts file to resolve names for local development. For some reason Chrome under OS X Lion takes about 10 seconds to resolve the name when it has to use the hosts file. So every request was taking about 10 seconds… almost the whole time it was waiting for DNS to time out.
Once I opened Safari to do local development the local web server was as zippy as before…..
Now I just have to figure out why Chrome is taking so long to resolve a name that is in the local hosts file.
[UPDATE]
To fix the Chrome slow issue… I just needed to move each entry in the /etc/hosts file to it’s own line.
so instead of
127.0.0.1 www.example.com www1.example.com
It would be
127.0.0.1 www.example.com
127.0.0.1 www1.example.com
While reconfiguring the network at the church, I noticed that my DNS queries were not getting curbed by OpenDNS. Browsing to ‘bad’ sites should give you a no no page from OpenDNS, but nothing was tripping it… not even 4chan :S
The I realized that Qwest is doing some DNS override where they actually do the DNS query.
The Solution
You need to opt out of this “wonderful” service from Qwest.
http://www.qwest.net/web.help/?confirm=1
After that, it was just fine.
I guess Qwest couldn’t resist trying to pick up that money on the table since they have access to all that traffic…. wonder how much money they make on ads.
When setting up a SSL certificate and chain file for Nginx, you need to combine them into one file. If you combine them in the wrong order you’ll get a message similar to the following.
When switching to Nginx I needed to have a variable that signified if the site was in HTTP or HTTPS mode. So I found this little bit of code.
map $scheme $fastcgi_https { ## Detect when HTTPS is used
default off;
https on;
}
This works great, but I really didn’t understand it until now so let’s take it line by line.
Line 1
map $scheme $fastcgi_https { ## Detect when HTTPS is used
This is where all the glory happens. $scheme is an internal variable within Nginx and is either HTTP or HTTPS (maybe some other ones in the future like SPDY). Then you have $fastcgi_https, this is the name of the variable we’re creating for future use in our config files. Nothing but comments after that stuff.
Line 2 and 3
default off;
https on;
This is our map of values. When Nginx’s $sheme variable is equal to “HTTPS”, then the $fastcgi_https variable will equal “on”, otherwise the variable just equals “off”.
Not too complex, but I just didn’t pick up on the format until now. Read more at
A curious error message popped up after I moved my Drupal sites to Nginx. It would only happen on AJAX type changes, but not all of them. I first noticed it when I went to change the author of a node. Then when I tried to change a View I received this error message.
After checking the logs on Nginx and watching what happens using Firebug’s Net panel, it occurred to me that Drupal was making an HTTP “OPTIONS” request.
The other detail is I was using HTTPS (SSL) enforced with the Secure Pages module. It when I was on the HTTPS side of the site those AJAX requests would be HTTP OPTIONS requests to the non-secure side HTTP.
The Solution
The solution was to disable HTTPS for certain pages in the Secure Pages config settings. Why Drupal was making OPTIONS calls to the none secure side of the site is still a mystery.
BTW. When your on the non-secure side, it makes a regular GET or POST request, not an OPTIONS request.
My newest toy I’ve been playing with is Nginx. Getting PHP to work over FastCGI. The performance gain over Apache + mod_php is quite staggering.
Here are a few things to watch out.
Getting PHP v5.2
Some of my apps are not ready to make the jump to PHP 5.3 just yet, so I needed to get a hold of PHP 5.2. In the past I just install the Zend Server CE it would have all the PHP bells and whistles I could ever need. Not anymore, now it’s time to fend for myself.
I’ve added webtatic to my repos and followed his advice to disable PHP 5.3 from his repos you add exclude=php*5.3* to your webtatic.repo file.
Now you can install PHP.
APC Opcode Cache
This waa a little more of struggle as I need to install various things to get it to work. I finally ran pecl install apc and it compiled fine. Then I added a file
/etc/php.d/apc.ini
extension=apc.so
PHP will pick that up and just enable it. Make sure to check that it’s enabled by running phpinfo(). Also you can download the source and extract the file apc.php Throw this on your server and run it in the browser, it will give you a nice rundown about the state of APC and let you know if it’s working.
PHP via FastCGI
There are a few ways to accomplish this and much debate on which is the best way, but I followed the instructions on
It lays it out plain, how to get a FastCGI daemon going. One change I did make though. It has the daemon listening on localhost:9000. I changed my to a socket located at /tmp/phpcgi.socket
Here is the /etc/init.d/php_cgi init script.
Zend Framework
One issue I ran into with Zend Framework, was the location of the sessions folder and the permissions. The default session folder is in /var/lib/php/session this was owned by apache, I just changed the owner:group to nginx:nginx. All was sunshine and roses again.