web stats OS X Client Server » OS X Web Server



Archive for the 'OS X Web Server' Category

Monitor and Keep Postfix Running on OS X

Thursday, December 20th, 2007

For some reason my postfix mail server kept crashing and would not stay up longer then one day. This got really annoying and made it impossible to use my server for any sites that had any email aspect to them. This week I found a really good way to monitor and keep postfix up and running at all times.

To do this you will need Webmin installed so if you dont already go install it now. Here are the instructions: Install Webmin on OS X

To set up a Postfix monitoring system:

1. Open Webmin

Webmin

2. Click the “others” tab

Webmin Others tab

(more…)

Help, Where did all my drive space go?

Saturday, August 11th, 2007

I noticed this week a big problem with my OS X Server. The finder was telling me that I only had 3 gb available. I counted the size of all the folders in my drive and it looked like I only had used about 15 gb so I should have 45 gb of free space. Some how I was losing 45 gb of space I no mater what tools I used I could not find was was stealing my hard drive space. On top of this my drive was filling up fast. Each day I lost more and more of the drive space. Soon this drive would be full.

I tried calling apple and their only suggestion was to format the drive. Since this was my server I dreaded this option. Luckily before I reported the brutality of a reformat I did a little creative googling. I found a few different forum posts that when used together saved my sanity..

The first command which found where the problem files were is:

In the terminal type (this command takes a long time to complete):

sudo /usr/bin/find -x / -size +40000000c -exec /bin/ls -lh “{}” \;

That command will find and list all the large files on your hard drive.

In my case the problem was a bunch of MYSQL Replication bin log files that were over 1 gig each.

To delete the old mysql_binary_log files I ran this command in mysql:

Login to mysql: mysql -u username -p

Then type

PURGE MASTER LOGS BEFORE DATE_SUB( NOW(), INTERVAL 5 DAY);

That command will remove any bin that are older then 5 days.

Running that one line command save me countless hours of work.

I has a similar problem with my relay logs on one of my slave servers.
running the command:
sudo /usr/bin/find -x / -size +40000000c -exec /bin/ls -lh “{}” \;

showed me that my problem was with my relay logs.

Im not sure that this is the right way to fix the relay log problem but it worked in my situation:

type in mysql:

change master to master_host='’”;

This changes the master host and deletes the old logs. This may not be how you want to do this because you might need restart replication.

Installing programs with the shell in OS X

Sunday, May 6th, 2007

Luckily on OS X most programs come with a nice installer program that allows you to click enter 3 or 4 times and magically the program is installed. Once and a while you may need to install and configure the script thru OS X’s Unix Shell via the Terminal. When ever I have to do this a small chill goes down my back. Most of the time it ends up being fairly straight forward but I am always away of the dangers of using the terminal. One wrong command can do a whole lot of damage. Typical steps for installing with the terminal are:

OS X Terminal

1 - Open a Terminal window (Applications -> Utilities - > Terminal)

Navigate to the folder of the script you are trying to install.

Type:
(more…)

Enable PHP Includes on OS X

Monday, April 23rd, 2007

PHP

Im in the process of switching to a new server. Tonight I noticed in my error log:

/var/log/httpd/error_log

This error:

[Mon Apr 23 02:27:30 2007] [error] PHP Warning: include(/script.php) [function.include]: failed to open stream: no suitable wrapper could be found in /script.php on line 26

I search around a bit and found the problem. The default instalation turns Has includes set to off for sucrity reasons. If you want to enable includes open:
(more…)

Install Webmin server tools on OS X

Sunday, April 15th, 2007

Webmin is the best tool I have ever used for OS X server. Webmin allows you to configure and monitor all of your servers parameters remotely.

Webmin
Here is a list of some of Webmins features:

-Configure almost all Apache directives and features.
-Create and edit domains and DNS records.
-Perform manual or scheduled backups and restores of configuration files managed by Webmin modules.
-View reports on bandwidth usage by host, port, protocol and time on a Linux system
(more…)

Optimize and Repair MYSQL Database on OS X

Sunday, February 11th, 2007

MYSQL comes with a very powerful tool to optimize and repair your database called mysqlcheck.

MYSQL

To have mysqlcheck check and repair all of your databases:

Open a Terminal window (Applications -> Utilities - > Terminal)

OS X Terminal
(more…)

Can’t connect to local MySQL server through socket /tmp/mysql.sock os x- ERROR 2002 (HY000) os x

Monday, December 4th, 2006

MYSQL

The other day suddenly MYSQL on my OS X web server stopped working.
I was getting this error:
ERROR 2002 (HY000) Can’t connect to local MySQL server through socket /tmp/mysql.sock

(more…)

Restarting an Apache Web Server on Mac OS X

Monday, December 4th, 2006

Apache Web server

Here is a simple way to quickly and seamlessly restart your OS X Apache webserver.

OS X Terminal
(more…)

Location of the php.ini file on Mac OS X

Monday, December 4th, 2006

PHP

I was looking for my php.ini file tonight so that I could change my error reporting to not log notices. I thought it was located at:

private/etc/php.ini

I was wrong… Making changes to this file did nothing for me. It turns out that on my installation of PHP (Marc Liyanage - entropy PHP version
http://www.entropy.ch/software/macosx/php/)

It turns out it was located in:

usr/local/php/lib/php.ini

Entropy PHP

Back up and restore MYSQL databases on OS X

Friday, November 10th, 2006

MYSQL

MYSQL is an amazing tool but when something goes wrong it can be a real disaster. Maintaining a good back up and recovery plan is an extremely wise step.

In OS X it is very easy to back up your MYSQL databases.

OS X Terminal

Open a Terminal window (Applications -> Utilities - > Terminal)

Change “DatabaseName” to the name of the database you want to back up and type:

/usr/local/mysql/bin/mysqldump -u root -p DatabaseName > backup.sql

or

mysqldump -u root -p DatabaseName > backup.sql
(more…)