# Install and configure Apache with PHP & MySQL



## Nokobon (Jun 23, 2009)

Hello guys,
it's the first time I seriously want to set up a webserver.

I want to use Apache 2.2 and I need PHP and a MySQL-Database.

Of course I'd like to keep the installation as minimal as possible, so I don't want anything not necessary for my purposes.
I have consulted the Apache documentation, but the short description of the modules did not really help me.

The problem is, that I don't really know what modules I need and how to install and configure it.

Do I have to install PHP and MySQL seperately or can I pull it in with the Apache installation?
And do I have to change some configuration before installing, so that modules I don't need are not compiled?
Or should I do a standard installation and configure everything later (removing unwanted modules, etc.)?

What procedure would you recommend?

I hope you can give me some tips...

Thanks,
Nokobon


----------



## SirDice (Jun 23, 2009)

Short version:

```
cd /usr/ports/www/apache22
make install clean
cd /usr/ports/lang/php5
make install clean # Select the option to build the apache module
cd /usr/ports/databases/php5-mysql
make install clean
```
That should pretty much cover the installation.


----------



## Nokobon (Jun 24, 2009)

Thank you for your answer!

I did exactly this on a testing mashine, but I have thought there could be some options I can disable at installation...

So, you think I just should install it this way and except for the PHP-module use the default options?
Doesn't that default configuration compiles modules I do not need for my purpose?


----------



## dennylin93 (Jun 25, 2009)

Descriptions of the Apache modules can be found here: http://httpd.apache.org/docs/2.2/mod/. If the module is a core module or you're unsure, don't uncheck it.

If you're using MySQL, you might want to check out lang/php5-extensions.


----------



## Nokobon (Jun 25, 2009)

dennylin93 said:
			
		

> Descriptions of the Apache modules can be found here: http://httpd.apache.org/docs/2.2/mod/. If the module is a core module or you're unsure, don't uncheck it.


As I said in my first post, I've read that part of the documentation, but the short descriptions of the modules does not really help me to decide whether I need it or not.
I am new to webserver-administration, therefore I don't really know if I need thinks like "RFC 1413 ident lookups" and "Content cache keyed to URIs".
So I'll just keep the standard module-configuration...


			
				dennylin93 said:
			
		

> If you're using MySQL, you might want to check out lang/php5-extensions.


What's the actual advantage of that port?
Does it install MySQL to work with PHP for me?


----------



## SirDice (Jun 25, 2009)

If you want MySQL you'll need to install databases/mysql51-server or any other version. Just make sure the mysql-client package is the same version as the server.


----------



## Nokobon (Jun 27, 2009)

SirDice said:
			
		

> If you want MySQL you'll need to install databases/mysql51-server or any other version. Just make sure the mysql-client package is the same version as the server.



Instead of databases/mysql51-server I can use databases/php5-mysql?
Where's the difference?


----------



## vivek (Jun 27, 2009)

Nokobon said:
			
		

> Instead of databases/mysql51-server I can use databases/php5-mysql?
> Where's the difference?



databases/php5-mysql MySQL server itself. It will store your data.

databases/php5-mysql - PHP module / API to access mysql database via Apache or or other web server.

I strongly suggest you get one LAMP book from oreilly books


----------



## Nokobon (Jun 28, 2009)

vivek said:
			
		

> I strongly suggest you get one LAMP book from oreilly books


I got the apache cookbock from oreilly...
It's great but not suitable for beginners who just want install and configure Apache for the first time.
Is there any specific book you would recommend for this?


----------



## DutchDaemon (Jun 28, 2009)

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-apache.html ?


----------



## Nokobon (Jun 28, 2009)

DutchDaemon said:
			
		

> http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-apache.html ?


Yes, of course I read the handbook...
I thought of a more detailed explanation of configuration and securing.
Maybe I'll go for Apache Security from O'reilly.


----------



## dvrts (Mar 26, 2013)

I do not want to create a new thread, so I will ask here - what is a possibility to install the latest versions of described software using ports? When I try to search using, for example [CMD=]whereis php[/cmd], I have nothing in output info. Thank you.


----------



## SirDice (Mar 26, 2013)

Handbook: 5.6 Using the Ports Collection


----------

