PHP 5 + Apache 2 + MySQL 5 on OS X via MacPorts

Filed under: note to self,server @ 14:28
# Displays all files in Finder.  Optional: personal preference.
$ defaults write com.apple.Finder AppleShowAllFiles YES
# Relaunch Finder

# Update MacPorts
$ sudo port selfupdate
$ sudo port -u upgrade outdated

# Install MySQL
$ sudo port install mysql5-server
$ sudo port load mysql5-server
$ sudo -u _mysql mysql_install_db5
$ sudo mysqld_safe5 &
$ sudo /opt/local/lib/mysql5/bin/mysql_secure_installation

# Install Apache, PHP (with PEAR), PHP MySQL bindings
$ sudo port install apache2
$ sudo port install php5 +apache2 +pear
$ sudo port install php5-mysql

# Configure Apache
# The following line may not be necessary
? sudo cp /opt/local/apache2/conf/httpd.conf.sample  /opt/local/apache2/conf/httpd.conf
$ cd /opt/local/apache2/modules
$ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
$ sudo nano /opt/local/apache2/conf/httpd.conf
# Set DirectoryIndex to:
# DirectoryIndex index.html index.php
# Change DocumentRoot to whatever (e.g. /Users/michael/Sites
# Change <directory "{old DocumentRoot}"> to <directory "{new DocumentRoot}">
# In that <directory "{new DocumentRoot}"> section change to the following.
# Options Indexes FollowSymLinks MultiViews
# AllowOverride All
# In <ifmodule mime_module> section, add the following two lines
# AddType application/x-httpd-php .php
# AddType application/x-httpd-php-source .phps
$ sudo port load apache2

# Configure PHP
$ sudo cp /opt/local/etc/php5/php.ini-development /opt/local/etc/php5/php.ini
$ sudo nano /opt/local/etc/php5/php.ini
# set mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket to
# /opt/local/var/run/mysql5/mysqld.sock

# Start Apache
# Make sure System Preferences → Sharing → Web Sharing is turned off. 
$ sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start
# You may get a window asking if httpd can accept incoming requests.  Approve it.

# Add DB and tables to MySQL for easy WordPress install
$ mysql5 -u root -p
> CREATE DATABASE database_name_here;
> GRANT ALL PRIVILEGES ON database_name_here.* TO "username_here"@"localhost" IDENTIFIED BY "password_here";

# Install and Configure phpMyAdmin (will need to restart Apache when done)
$ sudo port install phpmyadmin
$ sudo nano /opt/local/apache2/conf/httpd.conf
# Add section
# <Directory "/opt/local/www/phpmyadmin/">
#     Options Indexes MultiViews
#     AllowOverride None
#     Order allow,deny                                                                 
#     Allow from all
# </Directory>
# In <IfModule alias_module> section add the following
# Alias /phpMyAdmin "/opt/local/www/phpmyadmin"

$ sudo nano /opt/local/www/phpmyadmin/config.inc.php
# See http://www.phpmyadmin.net/documentation/Documentation.html#config
# Fill in $cfg['blowfish_secret']
# Set $cfg['Servers'][$i]['auth_type'] = 'config';
# Add $cfg['Servers'][$i]['user'] = 'root';
# Add $cfg['Servers'][$i]['password'] = '{root password}';

$ sudo /opt/local/apache2/bin/apachectl {start|restart|graceful|graceful-stop|stop}
$ sudo /opt/local/share/mysql5/mysql/mysql.server {start|stop|restart|reload|force-reload|status}


8000, you’ve treated me well

Filed under: neat!,news,server @ 02:17

In a way, I’m a little sad to see it go. My unconventional port and I have been together for a long time now. It’s been a source of conversation, intrigue and misplaced pride. Sadly, the pros of moving on outweigh the cons.

For those of you who hadn’t noticed after this ~day of being offline: http://blogwaffe.com.

I didn’t want to name names until all had settled, but I’m now very happy to say that blogwaffe is being served by TextDrive. I absolutely could not be happier with the service or its people. TextDrive’s servers are fast, highly configurable and very usable while all the while the folks running the show are friendly, helpful and knowledgeable nearly to the point of being scary. I had a couple questions about the best way to move the site over while maintaining the old links. Not only did they have answers, they had implementable solutions. Many thanks to Ryan, Jason and the lot.

Also, I’d be remiss if I didn’t give a loud shout out to Matt who was responsible for setting us up the bomb in the first place. So thanks, Matt.


“About” to change hosts — 13:15

I’m switching web hosts sometime in the next day or two. Hopefully all will go smoothly and barely a change will be noticed. If things b0rk, please let me know.


Twenty-Four Hours

Filed under: a group of folks,news,server @ 14:07

Our cable broadband service died yesterday around 2pm. So to the both of you that read this outside of my apartment and couldn’t find it yesterday, I apologize. That’s what you get for looking at a site hosted from some dude’s apartment.

But, man, I almost didn’t make it. How did I survive the entire year last year without internet access in my apartment? It boggles the mind and defies reason.

But we’re back now (though Paul.za and Greg don’t know yet). Until charter decides to freak out again.

We totally need a satellite feed. Or some backbone.


I’ve upgraded

Filed under: blogging,news,server @ 21:08

I know no one else cares, but my server is now running WordPress 1.3-alpha-5. A developer would surely disagree, but the code seems fairly stable (as in “not about to self immolate”, not as in “no longer changing”), so I think things should all theoretically work. On my end, though, I’m not 100% sure I’ve got all my bits in place, so let me know if something explodes.



Filed under: blogging,news,server @ 23:06

I have been admonished for having a slow site. I don’t access it much from outside my apartment, so I was unaware of the annoyance. I knew that the photos were slow to load; I’ve been thinking about preloading them ahead of time, but I’m not sure about the best way to do that. Photos may just have to be slow.

The more important issue is the images loaded in my css. They take too long. I’ve been thinking about reworking the style of the site, anyway. Perhaps I’ll try to get something a bit less bandwidth intensive. The real problem is that I’m doing my own hosting over a cable modem: not much uploading bandwidth. I’ll look into other possibilities, but I’m cheap.

As a stopgap, I’ll change a few links and have caltech host all my images, so at least those will load a bit faster.

I’ve also just finished importaing all my old .in need of a life. entries to this site. Many of the links are likely broken. I will not be fixing them. Deal with it.


Up and runnning

Filed under: blogging,news,server @ 14:40

Minus a few tweaks, I’ve finally got everything settled on my server. It was actually all surprisingly easy considering I had no idea what I was doing. Now that I’m hosting my own site, I have more control and can offer more functionality. It’s amazing how much better a truly database driven website can be over a “flat” design.



Filed under: rants,server @ 19:38

Damn you charter cable! Here I am spending hours trying to figure out what’s wrong with my webserver (it couldn’t be seen from outside the router), and it turns out that you’ve been blocking port 80 all along. You asses! What the hell kind of problem do you have with me having a webserver?


Tell me. Now. ‘Cause I’m listening. ON FREAKIN’ PORT 8000!!

New and Improved

Filed under: blogging,news,server @ 01:17

New domain: www.blogwaffe.com
New webserver: my old laptop
New blogging engine: … patience


Home Brewed Goodness

Filed under: neat!,news,server @ 11:36

So after a few days of compiling, my latop (~Dell Inspiron 7000) is up and running with Gentoo. Perhaps the biggest hurdle to usability was the button on the case that the lid presses when closed. This button suspends the computer. Since I wanted the laptop for a server, and since servers serve fairly poorly when suspended, this was unacceptable. I tried to install ACPI, but the daemon consistently refused to load no matter what kernel I used and no matter how completely I saw ACPI support compiled into those kernels. I finally decided my laptop was not compatible.

So I tried APM. The only useful feature that APM allowed was turning off the screen’s backlight. It had no control over the lid-close-button event. So, hell, I don’t need the button there, anyway, I thought. I’ll just take it out. I disassembled my entire laptop, removing drives, keyboard, screen, various bits of thermal shielding, etc. As it turns out, the button is not easily removed. This is an understatement. Not wanting to break out the soldering iron, I, after hours of attempting software control, and an hour or so of taking apart (and putting back together) the laptop, decided to cut off the button.

So I cut off the button. It works great now; I can close the lid, have the screen turn off and let the thing run as long as I want on less juice than a typical light bulb.

© mdawaffe (Michael D Adams) - Powered by WordPress - Full Credits