TimesToCome

Life on the third coast

10 Step WordPress Install on OSX 10.4




Instructions for setting up WordPress on Leopard It is a little different than 10.4

Notes:

I have read that MySQL 5.x will not work. I haven’t tried this I just used MySQL 4.1.

If you have installed everything right and WordPress still refuses to connect to the server see step 10 and the MySQL reference on OSX link at the end of this document.

If you are unclear on any thing I am doing try the two pages I link to at the bottom. I managed my install from their directions. Both give excellent directions but leave stuff out. I’m hoping everything is here but it may not be as clear or detailed as the other sites install information.

If you run into any problems and find a fix, be kind and post a note for the people who come after you.


You will need to down load MySQL 4.1.x and WordPress.


I. Turn on Personal Web Sharing on your Mac.
- Go to System Preferences -> Sharing
- Check Personal Web Sharing


II. Enable the root password on your Mac if you have not already done so.
- Open a terminal window ( Applications->Utilities->Terminal )
- At the command prompt type the following line and hit ‘enter’
sudo passwd root
- It will ask you for a new password – make it a good one!


III. Open the main MySQL installer or follow the directions in the Read Me file if you just downloaded the packaged files


IV. Configure MySQL
- Go back to the terminal window and type the following commands. Hit ‘enter’ after each line
su
{ it will ask you for that great password you just gave in the previous step }cd /usr/local/mysql
{ if you get an error here you need to make a soft link to mysql type the following at at command prompt }
cd /usr/local
ln -s mysql-standard-4.1.22-apple-darwin8.5.1-i686/ mysql
{ now replace mysql-standard-4.1.22-apple-darwin8.5.1-i686 with the version of sql you have. If you are not sure type }
ls
you should see a mysql…. directory that is the name you’ll use if yours is different than mine- Now type the following commands following each one with ‘enter’
cd /usr/local/mysql
./bin/mysqld_safe &- Try to connect to the MySQL server by typing
/usr/local/mysql/bin/mysql- Did you get a mysql prompt? Cool! Type ‘exit’ and hit enter. Are you back at a regular prompt? You should be.
- Set the root password for MySQL now
/user/local/mysql/bin/mysqladmin -u root password your_new_mysql_password- OK, now lets log onto MySQL and create your WordPress database
/usr/local/mysql/bin/mysql -u root -p
CREATE DATABASE wordpress;- Now create your WordPress user and password
GRANT ALL PRIVILEGES ON *.* TO user_name@localhost IDENITIED BY ‘user_password’ WITH GRANT OPTION;
{ replace user_name and user_password with the user name and password you want, leave localhost as is and leave quotes in place}
exit;- You should be back at a command prompt let’s see if we’ve got this right so far.
- Type
mysql -user user_name -p
- You should be asked for your MySQL password
- You should be logged on to a mysql prompt
- Type
SHOW DATABASES;
{ you should see your shiney new wordpress database }- Type
USE wordpress;- If all went well we’re done configuring MySQL


V. Unpack your WordPress download


VI. Move the WordPress folder to ‘Machintosh HD->Library->WebServer->Documents.
( almost done! )


VII. Check to be sure PHP is up and running on your Apache Server.
- Open a terminal window and type
su
{ it’s going to ask for your root password ( the really good one ) again }cd /etc/httpd{ now you have to edit the httpd.conf file – go slow – take your time I’m using emacs }
You are going to remove the # sign from four lines in this file
LoadModule php4_module
AddModule mod_php4.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phps
To do so with emacs at a command prompt type:
emacs httpd.conf
{ it will open up the file in the terminal window – take your time here }
Using the arrow keys just scroll down until you find the first line we are changing
Using the arrow keys go just the the right of the #
Use the delete keyFind the second line to be changed, do the same thing, just remove the # signNow type together ‘ctrl x followed by ‘ctrl’ s
{ emacs should tell you it saved the file }Now type together ‘ctrl x followed ‘ctrl’ c
{ you should be back at a regular terminal window }Now restart the webserver type httpd stophttpd start

VIII. Test the PHP
- Create the following file in your favorite editor< ?php
phpinfo();
?>Save it as testphp.php
Move it to /Machintosh HD -> Library -> WebServer ->Documents- Open a web browser
- Navigate to
http://127.0.0.1/testphp.phpYou should see a screen full of information about the PHP, MySQl and other Webserver information{ almost done }


IX. Set up Word Press
- In your favorite editor open the wp-config-sample.php file that is in the WordPress folder you stuck in the WebServer->Documents directory
You’ll see
define (‘DB_NAME’, ‘wordpress’ );
define (‘DB_USER’, ‘user_name’ );
define (‘DB_PASSWORD’, ‘password’ );You are going to change wordpress, user_name and password to the database, user and password you created in MySQLSave this file as ‘wp-config.php’- Test it
- Open a web browser and navigate to
http://localhost/wordpress/wp-admin/install.php Did it work? if so you’re all set skip step 10


X. Fix broken MySQL-PHP socket
- Open a terminal window and type
su
{ give it your password }cd /etc
cp php.ini.default php.ini
emacs php.ini{ now php.ini is open in an emacs window – go carefully and take your time! }
- scroll down to the [MySQL] section and find the line
mysql.default_socket =- retype that line to read
mysql.default_socket = /var/mysql/mysql.sock ‘ctrl’ x then ‘ctrl’ and s to save the file
‘ctrl’ x and ‘ctrl’ and c to exit emacs- now type
cd /var
mkdir mysql
chmod 775 myqlNow cd to mysql and typeln -s /tmp/mysql.sock mysql.sock{this creates a link from where php is looking to find mysql.sock and where mysql.sock is located }


I hope this helps you. I couldn’t have set mine up with out MySQL Reference for OSX and Installing WordPress on Tiger. If sometime I say is not clear or your run into troubles check both those sites for more information.


** To put your WordPress database on your local install. First back it up to a *.mysql.zip file using the WordPress backup ( under Manage ). Then import it to your local mysql database using the command
mysql -u userName -p wordpressDatabaseName < backupfile.mysql
Then adjust your wp-config.php to use that database. If you are using the same version of WordPress in both locations all should be well.One problem that shows up is that WordPress uses absolute urls rather than relative. So the WordPress install on your local machine may point to entries and stuff at the live site. To fix this you need to change the url. If you try to change it using the wp-admin tools on your local machine it points to your live site which you do not want to change.To fix this log onto mysql ( mysql -u your_username -p )select option_value from wp_options where option_name = ‘siteurl’;Use siteurl literally not your actual siteurl.It will show you were the WordPress install thinks it is located.

To change this to your local machine type

update wp_options set option_value = ‘http://127.0.0.1/wordpressDirectory’ where option_name = ‘siteurl’;

wordpressDirectory should be the local directory you installed your WordPress copy into. To be sure this is correct just retype the select option_value from wp_options where option_name = ‘siteurl’;

  •      
  •      
  •      

  •      
  •      
  •      
  •