GNU/Linux >> Linux の 問題 >  >> Cent OS

Centos8でのPhp7xおよびmssqlサーバーの操作

手順:

  1. DBサーバーにmssqlサーバーをインストールしてセットアップする
  2. phpと依存関係をphpサーバーにインストールします

レミリポジトリを有効にする

sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm

すべてが最新であることを確認してください

sudo dnf update

以前のバージョンまたは他のバージョンのphpが存在しないことを確認してください

dnf module reset php -y
dnf erase php php70 -y

それが完了したら、phpと依存関係をインストールします

dnf install php70 -y
dnf install -y \
    php70-php-fpm \ # to serve php content
    php70-php-pdo \ # for db connectivity
    php70-php-pear \ # to manage php deps with pecl
    php70-php-devel \ # for dev and header files required for installation from source
    php70-php-json \
    php70-php-mbstring \
    php70-php-gd \
    php70-php-xml \
    php70-php-zip

iniロケーションファイルを確認する

php70 --inic

これが私の出力です

$ php70 --ini
Configuration File (php.ini) Path: /etc/opt/remi/php70
Loaded Configuration File:         /etc/opt/remi/php70/php.ini
Scan for additional .ini files in: /etc/opt/remi/php70/php.d
Additional .ini files parsed:      /etc/opt/remi/php70/php.d/20-bz2.ini,
/etc/opt/remi/php70/php.d/20-calendar.ini,
/etc/opt/remi/php70/php.d/20-ctype.ini,
/etc/opt/remi/php70/php.d/20-curl.ini,
/etc/opt/remi/php70/php.d/20-dom.ini,
/etc/opt/remi/php70/php.d/20-exif.ini,
/etc/opt/remi/php70/php.d/20-fileinfo.ini,
/etc/opt/remi/php70/php.d/20-ftp.ini,
/etc/opt/remi/php70/php.d/20-gd.ini,
/etc/opt/remi/php70/php.d/20-gettext.ini,
/etc/opt/remi/php70/php.d/20-iconv.ini,
/etc/opt/remi/php70/php.d/20-json.ini,
/etc/opt/remi/php70/php.d/20-mbstring.ini,
/etc/opt/remi/php70/php.d/20-pdo.ini,
/etc/opt/remi/php70/php.d/20-phar.ini,
/etc/opt/remi/php70/php.d/20-posix.ini,
/etc/opt/remi/php70/php.d/20-shmop.ini,
/etc/opt/remi/php70/php.d/20-simplexml.ini,
/etc/opt/remi/php70/php.d/20-sockets.ini,
/etc/opt/remi/php70/php.d/20-sqlite3.ini,
/etc/opt/remi/php70/php.d/20-sqlsrv.ini,
/etc/opt/remi/php70/php.d/20-sysvmsg.ini,
/etc/opt/remi/php70/php.d/20-sysvsem.ini,
/etc/opt/remi/php70/php.d/20-sysvshm.ini,
/etc/opt/remi/php70/php.d/20-tokenizer.ini,
/etc/opt/remi/php70/php.d/20-xml.ini,
/etc/opt/remi/php70/php.d/20-xmlwriter.ini,
/etc/opt/remi/php70/php.d/20-xsl.ini,
/etc/opt/remi/php70/php.d/30-pdo_sqlite.ini,
/etc/opt/remi/php70/php.d/30-pdo_sqlsrv.ini,
/etc/opt/remi/php70/php.d/30-wddx.ini,
/etc/opt/remi/php70/php.d/30-xmlreader.ini,
/etc/opt/remi/php70/php.d/30-zip.ini

メインのphpiniファイルは、この場所の/etc/opt/remi/php70/php.iniにあります。

PHPホームは次のように設定されます:

/opt/remi/php70/root/

ここにバイナリ

/opt/remi/php70/root/usr/bin/

mssqlの依存関係をインストールする

リポジトリを追加:

curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo

次にインストール

sudo ACCEPT_EULA=Y yum install msodbcsql17
sudo dnf install -y unixODBC-devel

SQLサーバードライバーをインストールします。これは古いバージョンのphpであるため、新しいバージョンは機能しません。

/opt/remi/php70/root/usr/bin/pecl install sqlsrv-5.3.0
/opt/remi/php70/root/usr/bin/pecl install pdo_sqlsrv-5.3.0

ドライバーを有効にするには:

cat > /etc/opt/remi/php70/php.d/20-sqlsrv.ini <<EOF
extension=sqlsrv.so
EOF

cat > /etc/opt/remi/php70/php.d/30-pdo_sqlsrv.ini <<EOF
extension=pdo_sqlsrv.so
EOF

次に、php-fpmを再起動します

systemctl restart php70-php-fpm

Cent OS
  1. Centos6でPHPバージョンを5.3から5.2にダウングレードします

  2. MsSQL ServerCentos8に接続するためのphpをインストールしてセットアップします

  3. CentOS 7にApache、PHP、MariaDBを使用してZenarioをインストールします

  1. CentOS7およびRHEL7サーバーにPHP7.4、7.3、7.2をインストールする方法

  2. CentOS8にNginxとPHP7.3でNextcloudをインストールする方法

  3. /etc/shadow および /etc/passwd ファイルの変更を Auditd で監視するにはどうすればよいですか?

  1. CentOS8でPHP7.4を使用してOpenLiteSpeedをインストールおよび構成する方法

  2. CentOS7でPHP7を使用してOpenLiteSpeedをインストールおよび構成する方法

  3. Apache、PHP 7.2、Postfix、Dovecot、Pure-FTPD、BIND、およびISPConfig3.1を搭載したPerfectServer CentOS 7.6