Инсталляция FreeBSD в данной статье не рассматривается.
Счетается , что инсталлировать FreeBSD Вы умеете.
Сначала ставим и настраиваем базу данных.
exim# cd /usr/ports/databases/mysql51-server/
exim# make WITH_XCHARSET=all
exim# make install
Редактируем rc.conf:
exim# ee /etc/rc.conf
Добавляем:
mysql_enable=»YES»
Создаем конфигурационный файл my.cnf для MySQL.
exim#cp /usr/local/share/mysql/my-small.cnf /etc/my.cnf
Запускаем MySQL сервер:
exim# /usr/local/etc/rc.d/mysql-server start
Проверяем, запустился ли:
exim# ps -ax | grep mysql
Если видим подобное, то все в порядке:
72567 v0 S 0:00.01 /bin/sh /usr/local/bin/mysqld_safe —defaults-extra-f
72618 v0 S 0:00.15 /usr/local/libexec/mysqld —defaults-extra-file=/var/
72620 v0 R+ 0:00.00 grep mysql
Назначаем пароль для root mysql:
exim# mysqladmin -u root password 12345
проверяем, можем ли мы зайти под паролем
:
exim# mysql -uroot -p
Enter password:
Удаляем libtool-1.5.Х, так как будем ставить apache 2.2 , а ему требуется libtool22, иначе будет конфликт библиотек при сборке:
exim# pkg_info
exim# pkg_delete libtool-1.5.26
Ставим libtool22 для apache2.2
exim# cd /usr/ports/devel/libtool22/
exim# make
exim# make install
ставим apache2.2:
exim# cd /usr/ports/www/apache22
exim# make
exim# make install
Ставим PHP5:
exim# cd /usr/ports/lang/php5
exim# make
Options for php5 5.2.11_1
[X] CLI Build CLI version
[X] CGI Build CGI version
[X] APACHE Build Apache module
[ ] DEBUG Enable debug
[X] SUHOSIN Enable Suhosin protection system (not for jails)
[X] MULTIBYTE Enable zend multibyte support
[ ] IPV6 Enable ipv6 support
[X] MAILHEAD Enable mail header patch
[X] REDIRECT Enable force-cgi-redirect support (CGI only)
[X] DISCARD Enable discard-path support (CGI only)
[X] FASTCGI Enable fastcgi support (CGI only)
[X] PATHINFO Enable path-info-check support (CGI only)
exim# make install
Обращаем внимание на следующее объявление:
***************************************************************
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
***************************************************************
Cоздаем php.ini, позже придется в него вносить изменения:
exim# cp /usr/local/etc/php.ini-recommended /usr/local/etc/php.ini
Идем в конфигурационный файл апача:
exim# ee /usr/local/etc/apache22/httpd.conf
Ищем строку:<IfModule dir_module> и прописываем index.php,
Должно быть так:
<IfModule dir_module>
DirectoryIndex index.php index.html
Далее ищем строку:<IfModule mime_module> и добавляем:
AddType application/x-httpd-php .php и AddType application/x-httpd-php-source .phps
Т
.е. должно быть так:
<IfModule mime_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Так же необходимо разрешить работу с виртуальными хостами.По умолчанию эта возможность закоментирована.
Ищем строку
# Virtual hosts
и раскоментируем:
Include etc/apache22/extra/httpd-vhosts.conf
Ставим расширения PHP:
#cd /usr/ports/lang/php5-extensions/
#make
Options for php5-extensions 1.3
[X] BCMATH bc style precision math functions
[X] BZ2 bzip2 library support
[X] CALENDAR calendar conversion support
[X] CTYPE ctype functions
[X] CURL CURL support
[X] DBA dba support
[ ] DBASE dBase library support
[X] DOM DOM support
[X] EXIF EXIF support
[X] FILEINFO fileinfo support
[X] FILTER input filter support
[ ] FRIBIDI FriBidi support
[X] FTP FTP support
[X] GD GD library support
[X] GETTEXT gettext library support
[X] GMP GNU MP support
[X] HASH HASH Message Digest Framework
[X] ICONV iconv support
[X] IMAP IMAP support
[ ] INTERBASE Interbase 6 database support (Firebird)
[X] JSON JavaScript Object Serialization support
[ ] LDAP OpenLDAP support
[X] MBSTRING multibyte string support
[ ] MCRYPT Encryption support
[ ] MHASH Crypto-hashing support
[X] MING ming shockwave flash support
[ ] MSSQL MS-SQL database support
[X] MYSQL MySQL database support
[ ] MYSQLI MySQLi database support
[X] NCURSES ncurses support (CLI only)
[ ] ODBC unixODBC support
[X] OPENSSL OpenSSL support
[X] PCNTL pcntl support (CLI only)
[X] PCRE Perl Compatible Regular Expression support
[X] PDF PDFlib support (implies GD)
[X] PDO PHP Data Objects Interface (PDO)
[X] PDO_SQLITE PDO sqlite driver
[ ] PGSQL PostgreSQL database support
[X] POSIX POSIX-like functions
[X] PSPELL pspell support
[ ] READLINE readline support (CLI only)
[ ] RECODE recode support
[X] SESSION session support
[ ] SHMOP shmop support
[X] SIMPLEXML simplexml support
[X] SOAP SOAP support
[X] SOCKETS sockets support
[X] SPL Standard PHP Library
[ ] SQLITE sqlite support
[ ] SYBASE_CT Sybase database support
[ ] SYSVMSG System V message support
[ ] SYSVSEM System V semaphore support
[ ] SYSVSHM System V shared memory support
[X] TIDY TIDY support
[X] TOKENIZER tokenizer support
[ ] WDDX WDDX support (implies XML)
[X] XML XML support
[X] XMLREADER XMLReader support
[ ] XMLRPC XMLRPC-EPI support
[X] XMLREADER XMLReader support
[X] XMLRPC XMLRPC-EPI support
[X] XMLWRITER XMLWriter support
[X] XSL XSL support (Implies DOM)
[X] YAZ YAZ support (ANSI/NISO Z39.50)
[X] ZIP ZIP support
[X] ZLIB ZLIB support
exim# make install
exim# cd /usr/local/www/apache22/data
Создаем файл index.php для проверки:
touch index.php
ee index.php
<?phpinfo();?>
Редактируем rc.conf, разрешаем автоматический запуск служб:
exim# ee /etc/rc.conf
Добавляем:
apache22_enable=»YES»
Запускаем apache
exim# apachectl start
Заходим
https://IP_adress
броузером и видим информацию о сервере