Установка php 7 freebsd

Install Apache MariaDB and PHP 7 on FreeBSD 11

Установка php 7 freebsd

I know this wonderful system for a very long time. I like it and it’s giving me the feeling of security and transparency, the system was hacked some years ago but now, it looks strong and more open. One of the most powerful things on FreeBSD is the stability and the Solid File system. let me tell you how I have installed FAMP (FreeBSD Apache MariaDB PHP) on my VirtualBox.

My Test Server is FreeBSD based on VirtualBox tool and its running fine

Install Apache 2.4 in FreeBSD

To install Apache, please use the tool pkg to avoid any dependencies issues:

Start Apache at boot

To run apache www server from startup, add

Start Apache

Apache conf file in FreeBSD is “/usr/local/etc/apache24/httpd.conf”

Apache DocumentRoot in FreeBSD is under “/usr/local/www/apache24/data”

Check if Apache web server is running

Установка php 7 freebsd

How to install MariaDB On FreeBSD 11.x

Show the available release:

Now, install the latest Server and Client release

Now set mysql_enable to YES in /etc/rc.conf to automate starting MySQL server on next reboot

I’m setting up a medium sized server, so I’m going to copy /usr/local/share/mysql/my-medium.cnf to /usr/local/etc/ directory using cp command: # cp /usr/local/share/mysql/my-medium.cnf /usr/local/etc/my.cnf

Set MySQL root password

Alternatively, you can run:

If facing any problem, don’t hesitate to remove all files inside /var/db/mysql :

Restart MySQL and check

Install PHP 7 on FreeBSD 11

You need 2 packages mod_php71 php71-mysqli

Copy your php.ini from the template:

In order to configure PHP, you needed to edit the httpd.conf file.

Make sure that the line to load the php7_module did exist, and add the AddType below:

Also, add the following lines at the end of the file:

Check if the syntaxes are ok.

Now, create the PHP info test page

Restart apache and check http://ip/test.php

Установка php 7 freebsd

Установка php 7 freebsd

Install phpMyAdmin on FreeBSD 11

phpMyAdmin is also available in default repository of FreeBSD. You can install phpMyAdmin directly by running the following command.

Please find the release of phpMyAdmin:

Install now the release compatible with your PHP:

The above command will download and install phpMyAdmin. The application will be installed in /usr/local/www/phpMyAdmin/ directory.

Copy the sample phpMyAdmin configuration from the templates:

Источник

How to Install Apache PHP7 and MariaDB on FreeBSD12

Установка php 7 freebsd

My FreeBSD have IP 192.168.65.162

First Updates all your FreeBSD ports

Установка php 7 freebsd

1-Install apache on FreeBSD12

the package installer of FreeBSD is pkg

install with this comand

Установка php 7 freebsd

enable the daemon system-wide in FreeBSD.

Установка php 7 freebsd

Start Apache

Check the status

Apche24 root Directory is /usr/local/www/apache24/data you can edit the index.html to anything you want like my example bellow.

Please browse to the host : http://ip or http://fqdn

Установка php 7 freebsd

2-Install PHP7 on FreeBSD12

you have two ways to install PHP7

Install php 7 via Ports

Установка php 7 freebsd

Also do the same for the php extensions but to avoid any dependencies issues i will advice to install php from the pkg manager

install php7 via package manager on FreeBSD 12

Find latest php7 release from FreeBSD repositories

seach for the latest release from repo. for now is php72 is the latest release i think php73 will be sonn pushed to the repo

Install php72 and some needed pjp modules on FreeBSD 12

you see i’m using php71-mycript because the version 72 is not yet released till today

to make php working with apache we need extra php file configuration (/usr/local/etc/apache24/Includes/php.conf) with this content

Установка php 7 freebsd

How to test the PHP configuration.

Please do the follow command

Now restart apache and checlk http://ip/info.php

Установка php 7 freebsd

3-Install MariaDB on FreeBSD12

Now we will continue using the binary package method

Install Mariadb server and client

pkg install mariadb103-server-10.3.11 mariadb103-client-10.3.11 php72-mysqli1 php72-mysqli

Установка php 7 freebsd

Enable MariaDB server system-wide and start the database daemon

Configure and set root mysql password

Установка php 7 freebsd

Please login to see if your root password is working.

Установка php 7 freebsd

Sockstat command

This Sockstat will show you all connection listening on Ipv4

Источник

Install Apache PHP and MySQL on FreeBSD

In this tutorial you will learn how to setup a web server on FreeBSD using Apache Web Server, PHP programming language and MySQL/MariaDB database server. In addition to the LAMP stack we will also install phpMyAdmin for the database access and VSFTPD server for the FTP access.

Установка php 7 freebsd

This tutorial is compatible with the Latest FreeBSD version, freebsd 11.

Install and configure Apache Web Server on FreeBSD

Apache is the best server implementation for FreeBSD. The latest version of the Apache HTTP server for FreeBSD is provided by the www/apache24 package which you can install using the pkg command.

After the installation process is finished, open the /etc/rc.conf file and the following line (This will start HTTP server from startup).

Then, run the following command to start Apache Web server:

From a remote computer, Open a web browser and type the IP address of your FreeBSD server, You should get the response, It works!

Virtual Hosting

Apache Virtual Hosting is a mechanism that allows to host more than one website on a Single server. Following is the sample Apache Virtual Host configuration for FreeBSD (The virtual host configuration should be added to the httpd.conf file).

In this example, the domain name of the website is www.example.com, The DocumentRoot is /usr/local/www/example.com folder.

After you made changes to the httpd.conf file, you need to restart the Apache httpd web server:

Install PHP on FreeBSD

PHP: Hypertext Preprocessor (PHP) is a scripting language that is especially used to create dynamic web pages. For FreeBSD, several versions of PHP available.

At the time of writing, PHP 7.2 is the latest available version and is provided by the www/mod_php72 package.

To install PHP 7, Run the following command:

After the installation is finished, add the following to your Apache httpd.conf file:

Also make sure that index.php is part of your DirectoryIndex as shown below.

Run following command to create php.ini file:

Then, Restart the Apache HTTP Server:

Install MariaDB Database Server

We are going to use MariaDB as our MySQL server implementation, At the time of writing MariaDB Server 10.2 is the latest version. You can run pkg search command to find the latest version available on your FreeBSD system.

To Install MariaDB server, Run:

Then, add following to the /etc/rc.conf file:

Start the MySQL server for the first time:

By default MySQL root user does not have a password, to set up a new mysql root password run the mysql_secure_installation command.

Install phpMyAdmin on FreeBSD

The phpMyAdmin package that’s available from FreeBSD repository, not compatible with PHP version 7. For PHP 7 you need to download the latest version from the https://www.phpmyadmin.net/downloads/ page. The following section describes how to do it from the command line.

First install the mysqli and other PHP extensions:

Next, get the latest download link from the phpMyAdmin download page and download the package using wget command:

Extract archive file:

Create a file called phpmyadmin.conf inside the /usr/local/etc/apache24/Includes/ directory and add following configuration:

Save the file and restart the Apache Web Server:

To access phpMyAdmin type your server-IP/phpmyadmin in the web browser.

Configure FTP Server with vsftpd

File transfer protocol provides a simple and easy way to transfer files between the server and client computers. There are several FTP server softwares available for FreeBSD, the one we are going to use is vsftpd. The Following steps describe, how to install and configure VSFTPD on FreeBSD 11.1.

First install the vsftpd package:

Open the /usr/local/etc/vsftpd.conf and make sure that following configuration options are as it is:

Open the /etc/rc.conf and add following:

And we are ready to start the vsftpd server on FreeBSD:

Example: create an FTP user for the DocumentRoot

Following example demonstrate, how to create FTP user who have write access to the DocumentRoot of the example.com website.

Add new user with custom home directory:

Set Password for the user:

Set File permissions:

Now the FTP user can login to the server via FTP client and access the files of the website.

And VSFTPD completes our Web Server, Now you have complete Web Server up and running on your FreeBSD system.

Источник

Installing PHP7 on FreeBSD 10

Specifically, at time of writing, it’s PHP 7.0.3 on FreeBSD 10.1. Note that I would expect PHP7 to be officially available in FreeBSD and would hope that these instructions become redundant fast. Check for this with:

At time of writing, the port we’re looking at is in development on Github here and it was announced on the FreeBSD ports mailing list here.

As you may gather from the above, PHP7 is available via ports only, not pkgng as yet. To install, proceed as follows:

Now remove your existing php:

Follow this by installing any other PHP extensions you require. Note that in /usr/ports/Mk/bsd.php.mk I had to add the following at line 283 for database/php70-pdo_mysql to install:

Also note that Apache 2.4 is required. But who’s using 2.2 these days? Right.

Share this:

Установка php 7 freebsd

Thoughts, ramblings and rants of a husband, father, network engineer, sysadmin, coder, company owner, employer, closet geek, sci fi fan, political anorak, impatient grump.

I live in Dublin, Ireland with my wonderful wife and darling daughter.

IXP expert, management team and operations team with INEX, the internet peering point for the island of Ireland. Project manager and lead developer of IXP Manager, a free and open source platform powering almost 200 IXPs around the world. IXP advocacy and consultant in both commerical and pro bono capacities.

Provides an out-sourced CTO resource and other consultancy via Open Solutions.

Источник

Freebsd настройка php-fpm и nginx

Установка php 7 freebsd

Ранее я уже рассказывал, как установить и настроить Freebsd 10.1 в качестве web сервера ( 1 часть, 2 часть, 3 часть ) Там мы использовали Apache, nginx и php. Здесь же я хочу рассказать об установке и настройке связки nginx+php-fpm. По общепризнанному мнению, такая комбинация работает быстрее, чем связка с apache. Я на своем опыте в этом убедился. При прочих равных условиях, сайт wordpress выдерживает большую нагрузку с nginx и php fpm, нежели apache и php.

Приступим. У нас имеется:

Обновим до последней версии с помощью вот этой инструкции. Проверяем, что получилось:

Отлично, обновления прошли. Я не буду давать общие рекомендации по настройке сервера, я их уже давал во 2-й части инструкции, ссылки на которую я приводил выше. Можно посмотреть при желании. Приступим сразу к делу.

Установка и настройка mysql на Freebsd

Добавляем Mysql в автозагрузку:

Создаем для него конфигурационный файл:

Конфигурацию каждый под свои потребности может сделать, описаний настроек в интернете много. Я предлагаю свой универсальный вариант:

В моем варианте сервер жестко привязан к локальному интерфейсу и удаленно с ним работать нельзя. Если вам нужны удаленные подключения, то в параметре bind-address добавьте внешний адрес сервера.

Создадим файл логов:

Проверяем, все ли в порядке:

Демон запущен и слушает локальный интерфейс.

Теперь запустим скрипт для настройки безопасности:

Задаем пароль для root и далее на все вопросы отвечаем утвердительно:

Установка php 7 freebsd

На этом установка и настройка mysql закончена. Идем дальше.

Установка и настройка PHP-FPM на Freebsd

Начиная с версии php 5.3 php-fpm идет как модуль, поэтому просто начинаем установку php и указываем в опциях fpm:

Установка php 7 freebsd

Ставим теперь дополнения php-extentions:

Дополнений много, все ставить не обязательно, можно будет остальное доставить потом в случае необходимости. Я обычно выбираю наиболее популярные и необходимые:

BZ2, CTYPE, CURL, DOM, EXIF, FILTER, FTP, GD, GETTEXT, HASH, ICONV, JSON, MBSTRING, MCRYPT, MYSQL, MYSQLI, PDF, PDO, PDO_SQLITE, PHAR, POSIX, SESSION, SIMPLEXML, SQLITE3, YOKENIZER, XML, XMLREADER, XMLWRITER, ZIP

Добавляем php-fpm в автозагрузку:

Редактируем файл с настройками, приводим его к следующему виду:

Проверяем синтаксис настроек:

Проверяем запустился ли:

Все в порядке. Идем дальше.

Установка и настройка nginx на Freebsd

Устанавливаем nginx на наш Freebsd сервер:

Выбираем настройки по-умолчанию.

Добавляем nginx в автозагрузку:

Редактируем файл настроек. Я приведу пример с двумя виртуальными серверами, на одном из которых будут настройки для wordpress, другой будет для phpmyadmin, я люблю его вешать на отдельный поддомен.

Создаем необходимые каталоги:

Почему-то nginx не смог создать папку во временном каталоге. Поможем ему сами:

Все в порядке. Наш web сервер на Freebsd готов. Запускаем nginx и проверяем, нормально ли запустился:

Все в порядке, сервер запущен и слушает 80-й порт. Теперь проверим работу web сервера с помощью тестовой странички. Создаем ее:

Установка php 7 freebsd

Переходим на сайт по адресу http://site1.ru Не забудьте настроить DNS для доступа к установленному серверу, либо отредактируйте в windows файл hosts, добавив туда строку:

где 192.168.1.21 адрес web сервера Freebsd 10.

Вы должны увидеть картинку:

Установка php 7 freebsd

Если видите ее у себя, поздравляю, вы все настроили правильно и web сервер полностью готов к работе. Остался только маленький штрих. Для удобства управления mysql установим phpmyadmin.

Установка phpmyadmin на web сервер Freebsd

Перемещаем файлы из установочной директории по-умолчанию в наш поддомен pma.site1.ru:

Настраиваем DNS записи на pma.site1.ru или просто добавляем в винде в файл hosts строку

И заходим по адресу http://pma.site1.ru

Установка php 7 freebsd

У вас должно открыться окно приветствия phpmyadmin. Вводим сюда пользователя и пароль root, которые мы задали в самом начале настройки и попадаем в панель управления базами.

На этом настройка web сервера на базе Freebsd 10.1 и связки nginx + php-fpm закончена.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *