Scrigroup - Documente si articole

     

HomeDocumenteUploadResurseAlte limbi doc
AccessAdobe photoshopAlgoritmiAutocadBaze de dateCC sharp
CalculatoareCorel drawDot netExcelFox proFrontpageHardware
HtmlInternetJavaLinuxMatlabMs dosPascal
PhpPower pointRetele calculatoareSqlTutorialsWebdesignWindows
WordXml

AspAutocadCDot netExcelFox proHtmlJava
LinuxMathcadPhotoshopPhpSqlVisual studioWindowsXml

Installation on FreeBSD

php



+ Font mai mare | - Font mai mic



Installation on FreeBSD

PostgreSQL-PHP-Apache Intallation on FreeBSD-4.2-STABLE



by: hdr_wbw@yahoo.com

modified from: tomcat@weirdness.com

PostgreSQL - https://www.postgresql.org/

PHP - https://www.php.net/

Apache - https://www.apache.org/

FreeBSD - https://www.freebsd.org/

Files to download:

gettext-0.10.35.tgz (Freebsd site)

gmake-3.79.1.tgz (Freebsd site)

postgresql-7.1.2.tar.gz

php-4.0.6.tar.gz

apache_1.3.20.tar.gz

This is a step-by-step guide on PostgreSQL-PHP-Apache Intallation

First we'll work on the PostgreSQL installation. Create a PostgreSQL 'superuser'. This is who 'owns' the

database. I use the 'postgres' user, with the group being 'daemon'. See your system documentation on how to

do this (hint - man useradd). Give the user a home directory of /usr/local/pgsql as this is where PostgreSQL defaults to when it

installs.

Before installing PostgreSQL on FreeBSD, we need to install gettext-0.10.35 and gmake-3.79.1 as requirements for PostgreSQL

installation, using pkg_add command: (I assume all the source files are in the /usr/src/ directory)

# pkg_add gettext-0.10.35.tgz

# pkg_add gmake-3.79.1.tgz

And then we install PostgreSQL

# tar xzvf postgresql-7.1.2.tar.gz

# cd /usr/src/postgresql-7.1.2/

# ./configure

# gmake

# gmake install

Then we make a data directory data for PostgreSQL as a root, and change the permissions of the files

# mkdir /usr/local/pgsql/data

# cd /usr/local

# chown -R postgres.daemon pgsql

Next we have to set up the PostgreSQL database. Do this as the postgres user, not as root. In fact, PostgreSQL won't start as

root.

# su postgres

% /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

The '-D' option tells the database where the data is stored. When this finishes, it will tell you you can start the

server.

To start the PostgreSQL server:

% /usr/local/pgsql/bin/postmaster -i -S -D /usr/local/pgsql/data

We can check if it's already started:

% ps waux | grep postmaster

% exit

To make it automatically start when the computer starts, add this line into /etc/rc.local

echo 'postgresql' && su postgres -c '/usr/local/pgsql/bin/postmaster -i S -D /usr/local/pgsql/data'

That should be enough for PostgreSQL for now, we'll move onto PHP and Apache. PHP & Apache are always updating their

versions, so these examples might not give the latest available. Adjust to your own as nescessary. We need to unpack the source

code for these before we can do anything, so we do this -

# cd /usr/src/

# tar xzvf apache_1.3.20.tar.gz

# tar xzvf php-4.0.6.tar.gz

Now we actually get into the installation of the programs.

# cd apache-1.3.20/

# ./configure --prefix=/usr/local/apache

This gives us a configuration of Apache, PHP needs this for its installation. We'll go back to PHP again now.

# cd ..

# cd php-4.0.6/

We now configure PHP to work with PostgreSQL. This is the configure command I use, it works well -

# ./configure -with-pgsql=/usr/local/pgsql

? -with-apache=/usr/src/apache_1.3.20

? -enable-track-vars

? -without-mysql

You can type those continuously (without  for breaking a line)

Next we make it and install it.

# make

# make install

Next we make and install Apache.

# cd ..

# cd apache-1.3.20/

We have to run the configure command again to tell Apache we want to use the PHP module.

# ./configure --activate-module=src/modules/php4/libphp4.a

This file doesn't exist at the moment (libphp4.a), it will be created by the process.

# make

# make install

The Apache server is now installed. We only have a couple more steps to go through, and then we have a working PostgreSQL, PHP,

and Apache webserver.

We have to tell Apache how to deal with php scripts. We need to add this line to the httpd.conf file located in the

/usr/local/apache/conf/ directory (this is the default installation directory for Apache). You will see this line commented out,

there is a section for both PHP3 and PHP4, we want it added for PHP4. You can just uncomment it in the file.

Addtype application/x-httpd-php .php

We can check that PHP will be enabled and working with this command:

# /usr/local/apache/bin/apachectl configtest

It should return with

Syntax OK

If not, it will give an error and indication of what the error means.

The last thing we have to do, is set up a script to start Apache when the computer boots up. You actually get a program to do

this, its called 'apachectl' and is located in the /usr/local/apache/bin directory.

To start the Apache server:

# /usr/local/apache/bin/apachectl start

To make it automatically start when the computer starts, add this line into /etc/rc.local

echo 'httpd' && /usr/local/apache/bin/apachectl start

To test Apache in your browser (I use lynx as my standard browser):

# lynx https://localhost/

To test PHP, make a file test.php in /usr/local/apache/htdocs/ directory, with the folowing text:

<html>

<body>

<?php

phpinfo();

?>

</body>

</html>

and view this script through your browser:

# lynx https://localhost/test.php

All done!



Politica de confidentialitate | Termeni si conditii de utilizare



DISTRIBUIE DOCUMENTUL

Comentarii


Vizualizari: 1148
Importanta: rank

Comenteaza documentul:

Te rugam sa te autentifici sau sa iti faci cont pentru a putea comenta

Creaza cont nou

Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved