![]() ![]() Installing the MySQL client and server couldn’t be easier: sudo port install mysql5 mysql5-server Setup MySQLĬheck the end of the port install output and it’ll tell you which command to run to setup MySQL: sudo -u _mysql mysql_install_db5Īfter that, be sure to start up MySQL the same way we started Apache: sudo port load mysql5Īnd the output of the install_db5 script should give you another one to run, which will walk you through steps for securing MySQL (most notably changing the root password): sudo /opt /local /lib /mysql5 /bin /mysql_secure_installation Configure MySQL ![]() ![]() If not, well, start looking at your logs, you probably typo’d something… MySQL Client and Server Now load up and you should see PHP’s output. Make sure Apache is stopped: sudo port unload apache2Īnd start it again: sudo port load apache2Ĭreate an info.php file in your Sites directory: MacPorts provides a convenient method to add and remove launchctl launch daemons. Now that we’re done configuring we need to cycle the Apache server to make sure it’s running and using the latest configuration. You can research mod_fcgid configurations and tweak the 3 numbers (4, 0, and 0) if you wish, but I’ve found these defaults reliable enough. htm extension and need to allow PHP: DirectoryIndex index.html index.htm index.php mod_fcgid Configurationįinally, we need to tell Apache to use mod_fcgid to execute any pages with a. Inside the Directory block, find AllowOverride and change it to All: AllowOverride All Index Pageīy default Apache will only serve up index.html pages when you request a directory. htaccess files so things like mod_rewrite rules will work. Next I need to change the directives that are allowed in. Document RootĪgain, since it’s a development box I prefer just to serve pages out of my Sites directory, so next I’ll find these two lines: DocumentRoot "/opt/local/apache2/htdocs"Īnd change them to: DocumentRoot "/Users/chris/Sites" OS X puts users in the staff group by default, so you should only need to substitute in the name of your user account. Right below the modules, we’ll change the User and Group lines: User chris Since it’s only a development box, I prefer to avoid a lot of permissions and ownership issues by simply running Apache as myself. At the very end, add: LoadModule fcgid_module modules/mod_fcgid.so Change User and Group Look for a huge mass of LoadModule lines. Open /opt/local/apache2/conf/nf in your favorite text editor. Since we’re setting up our own mod_fcgid configuration, we’ll have to edit Apache’s config file manually. Now that our core web stack is installed we can make sure they’re all working together nicely. Final tools: Subversion, Git, anything else.Īpache sudo port install apache2 +workermpm PHP sudo port install php5 +fastcgi mod_fcgid sudo port install mod_fcgid Configure Apache, PHP, mod_fcgid.Assorted additional PHP extensions including php-mysql now that the server is installed.Strictly speaking I’m sure you could combine everything into one massive run, but the order I typically use is: I usually do everything in pieces just to make it easier for me to keep up with what I’ve installed and tackle any problems or errors I might run into. I’ve run into some assorted problems (like mod_rewrite configurations) in the past when I’ve switched between mod_php in development and php-cgi in production, so I’m now trying to use the same configuration for both. In my production environment I use Apache 2.2 with the Worker MPM, mod_fcgid, and php-cgi. For the most part you should be able to substitute in the names of the separate 5.3 ports for the variants for 5.2, but double check the available variants to be sure. If you’re still stuck at 5.2 for some reason you’ll want to install the php52 port with a number of variants. I recently switched from the legacy PHP 5.2 ports to the new 5.3 versions. Through dependencies we’ll get other tools that I consider essential: curl, rsync, sqlite, etc. I usually install Apache, PHP, MySQL, Subversion, and Git. Since I’ve now done this on both my systems in the last week it’s time to finally come up with an exact series of steps so I’ll have something to look at the next time around… The Software Stack Update : MacPorts disables all the default extensions when it compiles PHP, so I need to add back in the default POSIX extension.Įvery time I reinstall one of my OS X systems there’s a learning curve where I try to figure out what exactly I’d had installed using MacPorts before I wiped it and the commands and variants I used to get there. Supposedly about apache, git, guide, install, macports, mod_fcgid, mysql, os x, php, port, subversion, and tutorial. ![]()
0 Comments
Leave a Reply. |