# Deploy osx apache2 (plus php)

**URL:** <https://www.ruby-forum.com/t/deploy-osx-apache2-plus-php/85150>\
**Category:** Rails\
**Created:** [February 10, 2007, 5:03pm UTC](https://www.ruby-forum.com/t/deploy-osx-apache2-plus-php/85150 "2007-02-10T17:03:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dankelley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dankelley](https://www.ruby-forum.com/u/dankelley)\
**Post date:** [February 10, 2007, 5:03pm UTC](https://www.ruby-forum.com/t/deploy-osx-apache2-plus-php/85150/1 "2007-02-10T17:03:29Z")

</div>

I’m under the understanding that it is a good practice to have apache2  
installed for RoR, and so I’ve used macports on OSX to install that,  
and then I stopped the existing server and restarted the apache2  
instance using /opt/local/apache/bin/apachectl. So far, so good. I  
get the welcome screen when I point at localhost. But of course I  
don’t want to break other things on the machine, so I need to get  
apache2 to handle the existing PHP pages on the machine.

At that point I am blocked. I did a “port install php5”, and it  
worked without error, but I don’t see how to tell apache2 to know  
about this. I tried  
AddType application/x-httpd-php .php  
AddHandler php5 .php  
and restarted apachectl (without warning), but when I navigate to an  
existing page, I just see the PHP code, not the result.

Can anyone offer a pointer to get me going? I realize that I’m saying  
an ugly word (“php”) here, but I think it’s acceptable for me to ask  
this here, since others may also want to have both RoR and PHP pages  
deployed on a single machine.

---

<div class="post-metadata">

**Author:** ![dankelley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dankelley](https://www.ruby-forum.com/u/dankelley)\
**Post date:** [February 10, 2007, 5:16pm UTC](https://www.ruby-forum.com/t/deploy-osx-apache2-plus-php/85150/2 "2007-02-10T17:16:30Z")

</div>

On 2/10/07, dankelley [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> worked without error, but I don’t see how to tell apache2 to know  
> about this. I tried  
> AddType application/x-httpd-php .php  
> AddHandler php5 .php  
> and restarted apachectl (without warning), but when I navigate to an  
> existing page, I just see the PHP code, not the result.
> 
> Can anyone offer a pointer to get me going? I realize that I’m saying  
> an ugly word (“php”) here, but I think it’s acceptable for me to ask  
> this here, since others may also want to have both RoR and PHP pages  
> deployed on a single machine.

I suggest you take this somewhere else, there are plenty of mailing  
lists dedicated to apache configuration. Even a php list would be more  
appropriate.

And I do assume you’re talking about deployment here, where it makes  
sense to use apache 2.2 with mod\_proxy\_balancer in front of your  
mongrel clusters.

If it’s your development box, you should forget all about apache and  
just use webrick or mongrel stand-alone.

Isak

---

<div class="post-metadata">

**Author:** ![dankelley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dankelley](https://www.ruby-forum.com/u/dankelley)\
**Post date:** [February 10, 2007, 10:56pm UTC](https://www.ruby-forum.com/t/deploy-osx-apache2-plus-php/85150/3 "2007-02-10T22:56:04Z")

</div>

Hi, I would recommend that you following the following steps using  
MacPorts:

a) sudo port install php5 +apache2 +mysql5

b) cd /opt/local/apache2/conf

c) sudo cp httpd.conf.sample httpd.conf

d) add these commands to section “”  
of /opt/local/apache2/conf/httpd.conf:

AddType application/x-httpd-php .php  
AddType application/x-httpd-php-source .phps

e) add the following to DirectoryIndex in you httpd.conf:

```
index.php

For example, after you update the line DirectoryIndex, it should

```

look like this

```
DirectoryIndex index.html index.php

```

f) cd /opt/local/apache2/modules

g) sudo /opt/local/apache2/bin/apxs -a -e -n “php5” libphp5.so

h) cd /opt/local/etc

i) sudo cp php.ini-recommended php.ini

j) Add these commands to section “”  
of /opt/local/apache2/conf/httpd.conf:

k) update your path in your .profile to contain:

```
 /opt/local/apache2/bin

 e.g. Your path should look similar to the following after update:

 export 

```

PATH=/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:${PATH}

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![dankelley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dankelley](https://www.ruby-forum.com/u/dankelley)\
**Post date:** [February 10, 2007, 11:08pm UTC](https://www.ruby-forum.com/t/deploy-osx-apache2-plus-php/85150/4 "2007-02-10T23:08:04Z")

</div>

Hi, here’s updated steps for you because step (j) wasn’t needed in the  
previous e-mail:

a) sudo port install php5 +apache2 +mysql5

b) cd /opt/local/apache2/conf

c) sudo cp httpd.conf.sample httpd.conf

d) add these commands to section “”  
of /opt/local/apache2/conf/httpd.conf:

AddType application/x-httpd-php .php  
AddType application/x-httpd-php-source .phps

e) add the following to DirectoryIndex in you httpd.conf:

index.php

For example, after you update the line DirectoryIndex, it should  
look like this

DirectoryIndex index.html index.php

f) cd /opt/local/apache2/modules

g) sudo /opt/local/apache2/bin/apxs -a -e -n “php5” libphp5.so

h) cd /opt/local/etc

i) sudo cp php.ini-recommended php.ini

j) update your path in your .profile to contain:

```
/opt/local/apache2/bin

e.g. Your path should look similar to the following after update:

export 

```

PATH=/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:${PATH}

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![dankelley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dankelley](https://www.ruby-forum.com/u/dankelley)\
**Post date:** [March 2, 2007, 2:59am UTC](https://www.ruby-forum.com/t/deploy-osx-apache2-plus-php/85150/5 "2007-03-02T02:59:20Z")

</div>

On 28 Feb 2007, at 14:22, dankelley wrote:

> Hm. I get an error with step (a), as follows. Any ideas?
> 
> ```
> ---> Fetching mysql5
> ---> Attempting to fetch mysql-5.0.22.tar.gz from
> 
> ```
> 
> [http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/](http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/)  
> —\> Attempting to fetch mysql-5.0.22.tar.gz from  
> [http://mysql.he.net/Downloads/MySQL-5.0/](http://mysql.he.net/Downloads/MySQL-5.0/)  
> —\> Verifying checksum(s) for mysql5  
> Error: Checksum (sha1) mismatch for mysql-5.0.22.tar.gz

Don’t compile mysql yourself, but download the MacOS X installer  
package (from [http://dev.mysql.com/downloads/mysql/5.0.html#downloads](http://dev.mysql.com/downloads/mysql/5.0.html#downloads)):

Mac OS X (TAR packages) downloads (platform notes)

Mac OS X 10.3 (PowerPC, 32-bit)  
Standard  
5.0.27  
29.3M  
Download | Pick a mirror  
MD5: 7e4f9e07c7b923d5e3779ac4b76871b7 | Signature

Max  
5.0.27  
43.0M  
Download | Pick a mirror  
MD5: 48e3dd4d5074733dc8e25882c2a439db | Signature

Debug  
5.0.27  
48.7M  
Download | Pick a mirror  
MD5: 55b2367be3e56d5f772049d77a5829f3 | Signature  
Mac OS X 10.4 (PowerPC, 32-bit)  
Standard  
5.0.27  
27.8M  
Download | Pick a mirror  
MD5: 9925902f32c5a776d5fd3d14328e319e | Signature

Max  
5.0.27  
40.7M  
Download | Pick a mirror  
MD5: eb94ea97761cf13a9817db71ac962e87 | Signature

Debug  
5.0.27  
48.9M  
Download | Pick a mirror  
MD5: 198d781c015ab734be4b9ba530109a9f | Signature  
Mac OS X 10.4 (PowerPC, 64-bit)  
Standard  
5.0.27  
28.4M  
Download | Pick a mirror  
MD5: 1605d14fb3d6a1bf1e4c60d0273f49c1 | Signature

Max  
5.0.27  
41.9M  
Download | Pick a mirror  
MD5: c922ec57c9d12302704bfcd80044875e | Signature

Debug  
5.0.27  
49.0M  
Download | Pick a mirror  
MD5: dd84658cf78fac3427791c017652ed06 | Signature  
Mac OS X 10.4 (x86)  
Standard  
5.0.27  
26.8M  
Download | Pick a mirror  
MD5: 426d50a0d966d5cb6b4986820f99c32d | Signature

Max  
5.0.27  
39.2M  
Download | Pick a mirror  
MD5: aba373bcf859dbafc654cbdec5a5d9c1 | Signature

Debug  
5.0.27  
48.0M  
Download | Pick a mirror  
MD5: 679e144eb6ef2041206684c0651b7524 | Signature

---

<div class="post-metadata">

**Author:** ![dankelley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dankelley](https://www.ruby-forum.com/u/dankelley)\
**Post date:** [March 5, 2007, 11:49pm UTC](https://www.ruby-forum.com/t/deploy-osx-apache2-plus-php/85150/6 "2007-03-05T23:49:26Z")

</div>

Peter De Berdt wrote:

> Don’t compile mysql yourself, but download the MacOS X installer  
> package (from [http://dev.mysql.com/downloads/mysql/5.0.html#downloads](http://dev.mysql.com/downloads/mysql/5.0.html#downloads)):

This advice was _very_ helpful. Thanks, Peter.

---

<div class="post-metadata">

**Author:** ![dankelley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dankelley](https://www.ruby-forum.com/u/dankelley)\
**Post date:** [February 28, 2007, 2:23pm UTC](https://www.ruby-forum.com/t/deploy-osx-apache2-plus-php/85150/7 "2007-02-28T14:23:24Z")

</div>

Hm. I get an error with step (a), as follows. Any ideas?

```
---> Fetching mysql5
---> Attempting to fetch mysql-5.0.22.tar.gz from

```

[http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/](http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/)  
—\> Attempting to fetch mysql-5.0.22.tar.gz from  
[http://mysql.he.net/Downloads/MySQL-5.0/](http://mysql.he.net/Downloads/MySQL-5.0/)  
—\> Verifying checksum(s) for mysql5  
Error: Checksum (sha1) mismatch for mysql-5.0.22.tar.gz

---

<div class="post-metadata">

**Author:** ![dankelley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dankelley](https://www.ruby-forum.com/u/dankelley)\
**Post date:** [September 25, 2007, 11:10pm UTC](https://www.ruby-forum.com/t/deploy-osx-apache2-plus-php/85150/8 "2007-09-25T23:10:20Z")

</div>

On Feb 28, 9:58 am, Peter De Berdt [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Don’t compile mysql yourself, but download the MacOS X installer  
> package (fromhttp://dev.mysql.com/downloads/mysql/5.0.html#downloads):

Thanks, Peter. This was excellent advice. I messed around for a  
_long_ time trying to get the port version working. I am not sure my  
experience will be of any use to others, because a lot of my problem  
was in having an incorrect PATH variable, etc. Still, I can report  
that using this official MYSQL version _does_ work. And the panel  
item for starting it is quite nice – better than figuring out where  
the daemon is, better than issuing launchctl commands, etc.

Oh, one other thing to report – all my existing databases got  
trashed. No big deal; I have cronscripts items to do nightly  
backups. (Again, I don’t know if this is relevant to others reading  
this … perhaps I did something wrong.)
