version 1.3, 2017/12/24 17:44:32
|
version 1.5, 2018/08/06 21:22:03
|
Line 8 We will install all components using pkg
|
Line 8 We will install all components using pkg
|
|
|
# Installing the Apache webserver |
# Installing the Apache webserver |
|
|
The new Apache 2.2 server comes with two different threading models from which [prefork](http://httpd.apache.org/docs/2.2/mod/prefork.html) is installed by default. It is **not** recommended to use the Worker model, if you wish to use Apache and PHP. As that is the case, we will install a default Apache 2.2 server. |
The new Apache 2.4 server comes with two different threading models from which [prefork](http://httpd.apache.org/docs/2.4/mod/prefork.html) is installed by default. It is **not** recommended to use the Worker model, if you wish to use Apache and PHP. As that is the case, we will install a default Apache 2.4 server. |
|
|
# cd /usr/pkgsrc/www/apache22 |
# cd /usr/pkgsrc/www/apache24 |
# make install clean clean-depends |
# make install clean clean-depends |
|
|
|
|
This will install the Apache 2.2 server and all it's dependencies. The package currently depends on 10 other packages like perl, gmake and libtool to name a few. All dependencies are build before the Apache webserver is build, otherwise it wouldn't be dependencies. |
This will install the Apache 2.4 server and all it's dependencies. The package currently depends on 10 other packages like perl, gmake and libtool to name a few. All dependencies are build before the Apache webserver is build, otherwise it wouldn't be dependencies. |
|
|
If your build was successful, you should now edit the Apache configuration file _`/usr/pkg/etc/httpd/httpd.conf`_ to fit your needs. At least set the `Listen` Attribute and your `ServerName`. Please ensure that if your machines hostname does not globally resolve, to put it into your `/etc/hosts` file, otherwise Apache will refuse to start. |
If your build was successful, you should now edit the Apache configuration file _`/usr/pkg/etc/httpd/httpd.conf`_ to fit your needs. At least set the `Listen` Attribute and your `ServerName`. Please ensure that if your machines hostname does not globally resolve, to put it into your `/etc/hosts` file, otherwise Apache will refuse to start. |
|
|
Line 50 To stop the server, substitute start wit
|
Line 50 To stop the server, substitute start wit
|
|
|
You can skip this part, if you don't want to install a MySQL Server. To install the MySQL Server enter: |
You can skip this part, if you don't want to install a MySQL Server. To install the MySQL Server enter: |
|
|
# cd /usr/pkgsrc/databases/mysql5-server |
# cd /usr/pkgsrc/databases/mysql56-server |
# make install clean clean-depends |
# make install clean clean-depends |
|
|
|
|
Line 87 and restart your mysql server. To check,
|
Line 87 and restart your mysql server. To check,
|
# sockstat -l |
# sockstat -l |
|
|
|
|
For much more Options, consider reading the MySQL [Documentation](http://dev.mysql.com/doc/refman/5.0/en/). |
For much more Options, consider reading the MySQL [Documentation](http://dev.mysql.com/doc/refman/5.6/en/). |
|
|
|
|
# Installing the PHP Module for Apache |
# Installing the PHP Module for Apache |
Line 96 For much more Options, consider reading
|
Line 96 For much more Options, consider reading
|
# make install clean |
# make install clean |
|
|
|
|
This will install by default the latest Version of PHP 5.x and the PHP5 Module for Apache 2.2 |
This will install by default the latest Version of PHP 7.x and the PHP7 Module for Apache 2.4 |
|
|
## Configuring PHP |
## Configuring PHP |
|
|
Line 104 You should now add the Module and the PH
|
Line 104 You should now add the Module and the PH
|
|
|
Add following lines: |
Add following lines: |
|
|
LoadModule php5_module /usr/pkg/lib/httpd/mod_php5.so |
LoadModule php7_module /usr/pkg/lib/httpd/mod_php7.so |
|
|
|
|
and |
and |
Line 137 Now restart your Apache webserver. To te
|
Line 137 Now restart your Apache webserver. To te
|
<?php phpinfo(); ?> |
<?php phpinfo(); ?> |
|
|
|
|
if you use php5 and wish to use short tags like `<? phpinfo() ?>`, then edit your `/usr/pkg/etc/php.ini` file and change option `short_open_tag = Off `to `On` to make this line working. In PHP5 short_open_tag is off by default. |
if you use php7 and wish to use short tags like `<? phpinfo() ?>`, then edit your `/usr/pkg/etc/php.ini` file and change option `short_open_tag = Off `to `On` to make this line working. In PHP7 short_open_tag is off by default. |
|
|
Open your browser and point it to this url: |
Open your browser and point it to this url: |
|
|