Posted on November 18th, 2014 No comments
I recently got a new Macbook Pro (Mavericks) and decided to use the bundled Apache 2.2.6 and PHP 5.4.30.
All you have to do is uncomment the PHP extension:
LoadModule php5_module libexec/apache2/libphp5.so
in /private/etc/apache2/httpd.conf and start Apache:
sudo apachectl start
This had me up and running in no time, but after a few days I realized I needed some additional extensions, including MySQL, Mcrypt, Mongo and Redis.
Brew to the rescue
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
I set off to install some additional software and PHP-native extensions:
brew install redis ... redis-server start brew install php54-redis ==> Installing php54-redis from homebrew/homebrew-php ==> Downloading https://github.com/nicolasff/phpredis/archive/2.2.5.tar.gz ######################################################################## 100.0% ==> PHP_AUTOCONF="/usr/local/opt/autoconf/bin/autoconf" PHP_AUTOHEADER="/usr/local/opt/autoconf/bin/autoheader" /usr/local/Cellar/php54 ==> ./configure --prefix=/usr/local/Cellar/php54-redis/2.2.5 --with-php-config=/usr/local/Cellar/php54/5.4.33/bin/php-config ==> make ==> Caveats To finish installing redis for PHP 5.4: * /usr/local/etc/php/5.4/conf.d/ext-redis.ini was created, do not forget to remove it upon extension removal. * Validate installation via one of the following methods: * * Using PHP from a webserver: * - Restart your webserver. * - Write a PHP page that calls "phpinfo();" * - Load it in a browser and look for the info on the redis module. * - If you see it, you have been successful! * * Using PHP from the command line: * - Run "php -i" (command-line "phpinfo()") * - Look for the info on the redis module. * - If you see it, you have been successful! ==> Summary (beer) /usr/local/Cellar/php54-redis/2.2.5: 3 files, 216K, built in 9 seconds
Okay, now I should be able to use Redis commands (PHPRedis) in PHP, right?
sudo apachectl restart
How about now?
php -i | grep redis
Nope, phpinfo() doesn’t show it.
php -m | grep redis
Nada; no Redis extension. Rat’s why didn’t that work?
Let’s look back at the output from the brew php54-redis installer. This part in particular:
* /usr/local/etc/php/5.4/conf.d/ext-redis.ini was created,
So, what gives? That seems pretty legit. At least for an Apache & PHP config installed by Homebrew.
Oh, right, we didn’t do that.
Here’s the problem: That’s not where Apple’s default PHP build is configured to load extra parsed ini files from.
That path, by default, is:
To make the situation even more confusing, that path doesn’t even exist! And, it doesn’t even exist in any config file! It’s actually supplied as an argument (by someone at Apple who worked on the Mac OS X Mavericks Rom supplied to the Macbook Pro factory) when building the PHP binary:
Configure Command => ... '--with-config-file-scan-dir=/Library/Server/Web/Config/php' ...
which means we can’t even alter it without re-compiling PHP. Not that we couldn’t, but we don’t need to. Here’s why…
Symlinks for fun and profit
All we need to do is get the ini files created by homebrew installers to be loaded by the built-in Apache/PHP that ships with Apple and we are good to go.
Create this lame, un-changeable non-existent directory tree (-p is recursive; go figure):
sudo mkdir -p /Library/Server/Web/Config/php
Next, symlink in there the redis.ini
sudo ln -s /usr/local/etc/php/5.4/conf.d/ext-redis.ini /Library/Server/Web/Config/php/redis.ini
Finally, restart Apache
sudo apachectl restart
Did that work?
php -m | grep redis redis
Yep, I take that as a good sign.
All future installs of PHP extensions can be sudo symlinked into this same config-file-scan-dir and we’re good to go.
Posted on October 25th, 2011 No comments
Magic sauce, so easy to misplace:
The string, `netbeans-xdebug` is configurable inside NetBeans preferences.
Posted on August 15th, 2011 No comments
Zend Server is already the Cadillac of PHP Application Servers.
The Ferrari of PHP Application Deployments has arrived.
At least some, if not many PHP application developers are comfortable maintaining an Apache-based web server on Linux, the critical hardware that most often drives the web. Apache is free, and PHP is free, but you can’t be afraid to roll up your sleeves and get your hands dirty if you need to upgrade your software, install a new module, or tweak your server config.
Most, if not all PHP developers are familiar with Zend, the engine that powers the PHP scripting language interpreter, and many great sites are developed using the Zend Framework.
The Zend Framework is an enormous collection of ready-to-go building blocks (object-oriented PHP classes) for building just about any type of web application. There’s no question that their Zend Studio IDE ($299, built on Eclipse) is a solid PHP development platform, and Zend Server ($1,195 and up for support licenses) provides a terrific web-based GUI for managing your development, staging or production server’s LAMP stack.
A little pricey, maybe, but if you rely on a LAMP environment for your deployed software applications and you don’t have a lot of time or resources to be fiddling with your server software, Zend solutions still are excellent product choices to rely on from the company most closely associated with PHP development.
In today’s inbox, Zend announced a partnership with RightScale. If you’re not already familiar with RightScale, their service piggy-backs onto Amazon AWS to give you a nice, clean, friendly UI to manage and deploy webscale applications in the cloud. If you’ve ever experimented with Amazon AWS, you know it can be a little confusing and cumbersome to manage multiple server configurations as they scale.
With RightScale, you can save server templates and security group configurations, manage users and more. In the same way that Jenkins can help you automate testing your PHP applications and delivering them seamlessly to your server environments, RightScale can help you manage multiple-server cloud server application architectures with ease. Really a big time-saver.
Definitely not cheap, but absolutely worth checking out if you have a decent budget and need to save time managing PHP cloud deployments.
Scalable, Flexible, Portable PHP in the Cloud
RightScale and Zend recently introduced a solution to provide a best practices path to launching and maintaining highly-available PHP applications in the cloud. Learn more about the RightScale and Zend Solution Pack: attend our webinar on August 17.
Join us on August 17 for a demo of this new cloud solution that
enables you to:
• Provision a pre-configured, high availability PHP environment
• Autoscale your application based on system and application
• Receive system, server and application-level monitoring,
alerting and diagnostics
• Abstract your application from underlying cloud infrastructure to
enable future portability
Topic: Introducing “PaaS in a Box”: Scalable, Flexible, Portable PHP in the Cloud Date: Wednesday, August 17 Time: 9 AM PT / 12 PM ET / 5 PM BST / 6 PM CEST Speakers: Uri Budnik – Director ISV Partner Program, RightScale
Claudio Gentile – Sales Engineer, RightScale
Kevin Schroeder – Zend Technology Evangelist, Zend
Posted on November 3rd, 2009 No comments
I was just reading about how to write PHP scripts specifically for the command line.
points of interest:
- php -r ‘print_r(get_defined_constants());’
The latest Mac update, Snow Leopard, comes with pre-bundled with Apache 2.2, and PHP 5.3.
Here’s what I did to enable it and start making websites.
- Turning on Apache
To do this go to System Preferences -> click the checkbox by Web Sharing
- To check your Apache install
You might like this post about how to create a quick document for testing.
- Editing Apache Virtual Hosts
Paul Kukiel shares how to
- Turning on PHP
- Loading MySQL
Before you rebuild MySQL, double check your processor speed. If you upgraded to Snow Leopard from an older install on an older PPC or Intel Mac, be sure to know which processor type you need to build MySQL for. These instructions are for my Generation 5 Macbook Pro, not one of the brand new 64-bit models. Download the installer from MySQL.com. Then follow this post that shows how to build MySQL from source.
- Loading phpMyAdmin
- Using Terminal
I thought it would kind of tongue-in-cheek to create my first blog about creating my first blog. Although I’ve been a software developer and system architect for over a decade, I recently changed jobs. I was really excited to land a gig at this amazing SEO company in Arizona, Search Engine Rankings. They do everything you need online, and they have many spices in their secret sauce that other SEO Companies can only dream about.
Everyone I work with is exceptionally talented. One of the guys in particular is a great designer and a total WordPress junkie. As we were getting to know each other, he showed me a bunch of different WordPress sites that a casual observer would’t know were done with WordPress. Some pretty big companies, including CNN and millions of others, are using it. Thanks for the inspriation, DC.
Okay, I admit, even though I’ve been programming rich internet applications with PHP and Flash for years, I never actually downloaded and installed WordPress. I’ve studied various blogs. I’ve joined forums and even hosted a few different forums. I like a lot of different email lists. I’ve even programmed my own blogging software from scratch. I’ve checked out Joomla, Drupal, PHPNuke and a dozen other open-source CMS systems out there, but I felt that most of them were either too cumbersome, too restrictive, too ugly out of the box, required too much time to learn, or all of the above.
Not WordPress. Here I am, just 15 minutes after downloading, and I already have a nice looking site with a bunch of terrific backend functionality. The back end is a snap to use and elegantly designed. Version 2.7 has some rather useful AJAX features as well, making it extremely intuitive, as well as providing “Automatic Draft Saving” as you write. In short, I’m impressed. I guess it goes to show you that you don’t know what you don’t know. So here’s my recommendation to you, if you’re looking to setup a blog of your own using WordPress in 3 Easy Steps. I know it can be done because I’ve just done it. Here goes:
Step 1: Stop Procrastinating.
Nothing will ever harm your ability to create your first WordPress blog more than never getting around to it. In one of the best audio books on CD I’ve ever listened to, the author states that before you can do something, you have to think about it. But before you can think about it, you have to believe. Believe in what you’re doing, belief in yourself, belief that it’s not a waste of time, belief that it’s so easy anybody can do it. The lack of focus on belief is one of the fundamental problems with modern society. In short, if you want to create a WordPress blog, the first step is to believe that now is the time to do it. That belief causes a thought about what you might write if you had easily installed WordPress. That thought causes the action of going to the WordPress.org Website and downloading the latest version, reading some help files and introductions for beginners, etc. For humanity to evolve and save the planet, we have to reverse the current action -> thought -> belief model, and start beliving -> then thinking -> then doing.
Step 2: Download and Install WordPress. And pick a cool theme while you’re at it.
For the total beginner, this may seem like a giant leap of faith, and maybe it is, but I’m here to tell you that you can do anything you set your mind to. If you’ve never heard of FTP nor used your website control panel before, this may seem like a daunting, if not, insurmountable task. In a nutshell, all you have to do is download the zip file, extract it somewhere on your computer where you can find it again (try the desktop), and then upload the files to your website using any FTP Program. There are dozens of pages in the WordPress Installation help that walk you through this. The trickiest part for the beginner by far is creating a database, assigning a user, and editing the config file, but in truth it’s not difficult to figure out at all. Usually, you only need 3 pieces of info: the database name, the username and password. If you don’t know how to find phpMyAdmin within CPanel or Plesk, send an email or create a trouble ticket with your ISP. Also, many ISPs have Fantastico installed for CPanel, which lets you install WordPress with a single click. Ask your ISP. One more tip: Always read the ReadMe file that comes with any download. The ReadMe file that comes with WordPress has a nifty Famous 5 Minute Install right at the top that spells out each step, with links to more detail if you need clarification. If you try on your own to get started with WordPress and run into trouble, you can always contact a WordPress Customization Expert for help.
Step 3: Login and start blogging.
Assuming you got this far, you might find it somewhat ironic that the moment you complete step 2, you’ll receive an automagically generated email from yourself telling you what your randomly-generated password is to your own Blog. It may seem scary at first, but by taking this monumental step in your own evolution, in less than 4 steps, you’ve become the system administrator of a database-driven online software application that provides you with real-time worldwide multimedia content publishing capabilities. Think of it like your own channel. Your own network. Being responsible for your actions is one thing — but a whole network!? With the power WordPress gives you to project your thoughts and beliefs out to the world-wide stage — I can see how that may seem like a lot of pressure. It’s no wonder you procrastinated so long.
But have no fear — the anxiety, stress and worry you feel is just temporary and rapidly subsides. Once you start blogging, editing tags, setting up categories, trying themes, adding plugins and approving comments… you’ll wonder how you ever got along without your very own Blog on the World Wide Web.