473,698 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Configuring Apache, PHP, and MySQL for Mac OS X

tolkienarda
316 Contributor
hi all,

i have been having problems with mamp and i have decided that it probably isn't worth the trouble. problem being that i was relying on that to run a small stupid php mysql program on a mac server. so i think i just want to install apache, mysql, and php seperate i was getting ready to start on this adventure then i realized i didn't know where to start. so i know i need to install the three services but i have no idea how to config stuff to make them communicate, i have always used rackspace managed hosting and without their support team i am totaly lost. so if anyone has any ideas or knows how i can do this i would be greatful

eric
Sep 22 '07 #1
3 3317
pbmods
5,821 Recognized Expert Expert
Heya, Eric.

Configuring Apache, PHP and MySQL from source is not too difficult, and after awhile, it can be fun!

Really.

Maybe just for me.

Anyway, here we go.

The first thing you'll want to do is download the most recent versions of the source for Apache, MySQL and PHP.

Apache
MySQL
PHP

Note that MySQL has two downloadable versions: there's a fully-compiled version for Mac OS X, or you can download the source code. I prefer the source because then I can configure it to only support Unicode, but it's up to you.

Setting Up

Unzip / untar each archive (Mac OS X's BOMArchiveHelpe r will do this for you when you double-click on the downloaded file).

In the Finder select Go->Go to Folder... and type /usr/local. Click Go.

Create a new folder and name it 'src'. We're going to store all our source files in this directory.

Copy each source folder into /usr/local/src.

Launch Terminal.app and cd /usr/local/src.

Compiling Apache

In the Terminal, cd into your httpd source folder (the tab key is your friend).

Now, you can get wildly complicated with this (to see just how complicated, issue ./configure --help), but we're going to stick to the basics for now.

We're going to configure Apache with support for Mass Virtual Hosting (mod_vhost_alia s) and URL Rewriting (mod_rewrite).

Issue the following commands:
Expand|Select|Wrap|Line Numbers
  1. > ./configure --cache-file=config.cache --enable-shared --disable-static --enable-vhost-alias --enable-rewrite
  2. > make
  3. > make check
  4. > sudo make install
make check will take awhile. Go grab yourself something to drink.

Of course, you will want to make sure that your build doesn't fail any tests before issuing a make install.

Note also that we did not configure Apache with SSL support. To get this working, you will need to install OpenSSL. If you need this, post back, and we'll get you set up.

Compiling MySQL

PHP requires that MySQL be installed first, so the next app to compile is MySQL.

cd into your MySQL source directory.

If you downloaded a pre-compiled version of MySQL, you're all set to go. All you need to do is copy the contents of the distro to /usr/local:
Expand|Select|Wrap|Line Numbers
  1. >cp -r /usr/local/src/mysql-{version info} /usr/local
  2. >ln -s /usr/local/mysql-{version info} /usr/local/mysql
  3.  
Replace {version info} with your MySQL version info. For example, if you downloaded version 5.0.45 for PowerPC, your folder might be named mysql-5.0.45-osx10.3-powerpc.

And you're done.

If you've opted to compile the source code instead, you'll need to issue these commands:
Expand|Select|Wrap|Line Numbers
  1. > ./configure --config-file=./config.cache --enable-shared --disable-static --prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_unicode_ci --with-extra-charsets=none
  2.  
Remove that '--with-extra-charsets=none' if you want to be able to use character sets other than utf8.

MySQL also has additional configuration options (./configure --help).

Next, do the standard
Expand|Select|Wrap|Line Numbers
  1. > make
  2. > make check
  3. > sudo make install
  4.  
MySQL's make check takes even longer than Apache's. Go grab something to eat.

Compiling PHP

cd into your PHP source directory.

PHP's a lot of fun to configure (./configure --help). We'll stick to the bare bones here:
Expand|Select|Wrap|Line Numbers
  1. > ./configure  --cache-file=config.cache --enable-shared --disable-static --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-gd --with-curl
  2. > make
  3. > make test
  4. > sudo make install
  5. > sudo pear upgrade-all
  6.  
There are many many MANY more configuration options, and you may need some of them, but fortunately, it is possible (and in fact quite easy) to compile PHP without affecting your Apache nor MySQL installations, so you are always free to experiment, and you can post back anytime you get stuck :)

Note that PHP has make test instead of make check. PHP takes the least time to test of the 'big three'. Go do something that doesn't take long.

PHP will probably fail several tests. That's OK. A lot of functionality in the PHP language is experimental or not widely supported. As an example, my PHP build failed almost 200 tests (out of close to 3000, which works out to approximately 95% passed), but not a single one of them was for functionality that I will ever use.

And you can always recompile and install without affecting any of your other apps.

To start up Apache, issue:
Expand|Select|Wrap|Line Numbers
  1. > sudo /usr/local/apache2/bin/apachectl start
  2.  
And MySQL:
Expand|Select|Wrap|Line Numbers
  1. > sudo /usr/local/mysql/support-files/mysql.server start
  2.  
The location of the mysql.server file varies from build to build; it might be in /usr/local/mysql/bin instead.

Tune in next week to find out how to set up Mac OS X to automatically start httpd and mysqld at startup!

PS. Remind me to post this as an article.
Sep 23 '07 #2
pbmods
5,821 Recognized Expert Expert
You might get errors if you try to compile MySQL with --cache-file=config.cac he.

This line will work:
Expand|Select|Wrap|Line Numbers
  1. ./configure --enable-shared --disable-static --prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_unicode_ci --with-extra-charsets=none
  2.  
Sep 23 '07 #3
tolkienarda
316 Contributor
you are officially my hero

eric
Sep 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4810
by: Jeff | last post by:
Could someone walk me step by step on how to install and get JpGraph running on a Windows 2000+Apache+PHP+MySql server? -Thanks Jeff
2
2002
by: Randell D. | last post by:
Folks, I've never implemented a secure server before - and I now have a project for it - It will be an Apache 1.3 environment tuned with PHP and MySQL - and I'd appreciate any comments/advice/note from folk who have done similar. I have my application working fine in a non-SSL environment and believe the switch-over should not be too difficult. But... Can someone confirm the following:
0
1578
by: bruce | last post by:
Hi... A mysql/Apache issue: I get the following when I'm trying to run a test web site on an Apache 2.0/RH8.0 setup. -------------------------------- Warning: Access denied for user: 'apache@localhost' (Using password: YES) in /var/www/html/dbid/mysql/database.php on line 17
0
2030
by: bruce | last post by:
Hi... Update.... We have the following setup in our httpd.conf file. We've tried to give what's related to the issue. We're trying to set up a virtual host for a test project. The behavior that we're seeing is that we can type: http://foo.com but the url that gets displayed is
0
3783
by: zhenya.tkachenko | last post by:
Hi! Have a problem with mod_auth_mysql. Compilation and installation of module done ok: # /usr/local/apache/bin/apxs -c -L/usr/lib/mysql -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c /usr/local/apache/build/libtool --silent --mode=compile gcc -prefer-pic -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache/include
3
3747
by: rabbithutch | last post by:
This is a newbie, first-time post on this forum. I need help getting MySQL installed on my local server so that it will inter-operate with Apache 2.2. I am running WinXP Pro V2002 SP-2, Apache 2.2 and PHP 5. The server seems to be running correctly because when I enter "http://localhost/filename.ext" in my browser's (IE, Fx, Op) address bar the named file displays as designed. Also, my text editor (HTML Pad 2006) previews my files, but of...
10
2540
frozenmist
by: frozenmist | last post by:
Hi guys, I am new to php. I was just trying to learn. I am trying to create a forum using phpbb. I also have MySQL server running. While installing an error is being raised as: An error has occurred during installation The PHP configuration on your server doesn't support the database type that you chose Somebody do help me.. Cheers
3
4936
by: joe jacob | last post by:
I configured apache to execute python scripts using mod_python handler. I followed below mentioned steps to configure apache. 1. In http.conf I added <Directory "D:/softwares/Apache2.2/htdocs"> AddHandler mod_python .py PythonHandler mptest PythonDebug On </Directory>
2
1918
by: lawrencesiow | last post by:
hi all, i got some problems with mysql when i test my phpinfo page i didn't see any mysql information at there and also when i try to test my other php pages, i received an error, Fatal error: Call to undefined function mysql_connect() im using mysql 5.1.41 php 5.2.12 apache_2.2.14 i also have IIS 6 on my windows vista. but apache and php is working fine as i changed the port no for IIS, i presume.
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9028
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7728
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.