Cov Lus Qhia Rau PHP Installation ntawm Ubuntu Server

Pin
Send
Share
Send

Web application developers yuav muaj teeb meem txhim kho cov lus PHP scripting ntawm Ubuntu Server. Qhov no yog vim muaj ntau yam. Tab sis siv cov lus qhia no, txhua tus neeg tuaj yeem zam dhau qhov ua yuam kev thaum teeb tsa.

Txhim kho PHP hauv Ubuntu Server

Txhim kho cov lus PHP hauv Ubuntu Server tuaj yeem ua ntau txoj hauv kev - nws txhua tus nyob ntawm nws cov version thiab version ntawm lub operating system nws tus kheej Thiab lub ntsiab sib txawv nyob hauv cov pab pawg lawv tus kheej, uas yuav tau ua kom tiav.

Nws kuj tseem tsim nyog sau cia tias PHP pob suav nrog ntau lub Cheebtsam uas, yog xav tau, tuaj yeem ntsia tau sib txawv los ntawm ib leeg.

Txoj Kev 1: Txheem Txhim Kho

Ib qho kev teeb tsa tshwj xeeb yuav siv qhov tseeb ntawm pob. Hauv txhua tus Ubuntu Server operating system, nws txawv:

  • 12.04 LTS (Qhov Ntsuas) - 5.3;
  • 14.04 LTS (Kev ntseeg siab) - 5.5;
  • 15.10 (Wily) - 5.6;
  • 16.04 LTS (Xenial) - 7.0.

Tag nrho cov pob khoom tau faib tawm los ntawm kev tshaj tawm txoj haujlwm operating system, yog li koj tsis tas yuav txuas cov neeg thib peb. Tab sis lub installation ntawm tag nrho cov pob yog ua nyob rau hauv ob version thiab nyob ntawm OS version. Yog li, rau nruab PHP rau Ubuntu Server 16.04, khiav qhov lus txib no:

sudo apt-tau nruab php

Thiab rau cov ua ntej lawm:

sudo apt-tau nruab php5

Yog tias koj tsis xav tau txhua yam khoom siv ntawm PHP pob hauv kab ke, koj tuaj yeem nruab lawv cais. Yuav ua li cas ua li no thiab cov lus txib twg thiaj ua qhov no yuav tsum tau piav qhia hauv qab no.

Tus qauv rau Apache HTTP Server

Txhawm rau nruab PHP module rau Apache ntawm Ubuntu Server 16.04, koj yuav tsum khiav cov lus txib nram qab no:

sudo apt-mus nruab libapache2-mod-php

Hauv kev siv ua ntej ntawm OS:

sudo apt-mus nruab libapache2-mod-php5

Koj yuav raug nug txog tus lej zais, tom qab nkag mus uas koj yuav tsum tso cai rau nruab. Ua li no, sau tus ntawv D lossis "Y" (nyob ntawm cov localization ntawm Ubuntu Server) thiab nyem Sau.

Txhua yam uas tseem nyob yog tos rau kev rub tawm thiab teeb tsa cov pob kom tiav.

FPM

Txhawm rau nruab FPM ntawm kev ua haujlwm operating version 16.04, ua cov hauv qab no:

sudo apt-tau nruab php-fpm

Nyob rau hauv ua ntej lawm versions:

sudo Apt-tau nruab php5-fpm

Hauv qhov no, lub installation yuav pib cia, sai li sai tau tom qab nkag mus rau tus lej superuser.

KAWG

CLI xav tau rau cov neeg tsim khoom uas tsim cov kev pab cuam console hauv PHP. Txhawm rau siv hom lus programming no hauv nws, hauv Ubuntu 16.04 koj yuav tsum khiav qhov lus txib:

sudo apt-tau nruab php-cli

Nyob rau hauv ua ntej lawm versions:

sudo apt-tau nruab php5-cli

PHP txuas ntxiv

Txhawm rau kom ua txhua txoj haujlwm ntawm PHP, nws tsim nyog rau nruab ntau cov txuas ntxiv rau cov kev zov me nyuam siv. Tam sim no nrov tshaj plaws cov lus txib rau xws li kev teeb tsa yuav raug nthuav tawm.

Nco tseg: hauv qab no, ob lo lus txib yuav muab rau txhua qhov txuas ntxiv, qhov twg thawj zaug rau Ubuntu Server 16.04, thiab qhov thib ob yog rau cov ua ntej dhau los ntawm OS.

  1. Kev txuas ntxiv rau GD:

    sudo apt-tau nruab php-gd
    sudo apt-tau nruab php5-gd

  2. Txuas rau Mcrypt:

    sudo apt-mus nruab php-mcrypt
    sudo apt-tau nruab php5-mcrypt

  3. Txuas rau MySQL:

    sudo apt-mus nruab php-mysql
    sudo apt-mus nruab php5-mysql

Saib ntxiv hauv: MySQL Installation Qhia txog ntawm Ubuntu

Txoj Kev 2: Nruab Lwm Ib Qho Cawv

Nws tau hais los saum toj no uas nyob hauv txhua version ntawm Ubuntu Server sib thooj PHP pob yuav raug ntsia. Tab sis qhov no tsis txwv qhov tseem ntawm txhim kho ua ntej los yog, hloov dua siab tshiab, tom qab version ntawm hom lus programming.

  1. Ua ntej koj yuav tsum tshem tag nrho cov phoo PHP uas tau tsim kho yav tas los. Txhawm rau ua qhov no, hauv Ubuntu 16.04, khiav ob lo lus txib:

    sudo apt-tau tshem tawm libapache2-mod-php php-fpm php-cli php-gd php-mcrypt php-mysql
    sudo apt-tau autoremove

    Hauv kev siv ua ntej ntawm OS:

    sudo apt-tau tshem tawm libapache2-mod-php5 php5-fpm php5-cli php5-gd php5-mcrypt php5-mysql
    sudo apt-tau autoremove

  2. Tam sim no koj xav tau ntxiv PPA rau cov npe chaw sau cia, uas muaj cov pob ntawm txhua qhov qauv ntawm PHP:

    sudo add-apt-repository ppa: ondrej / php
    sudo apt-tau hloov tshiab

  3. Txij ntawm no mus, koj tuaj yeem nruab tag nrho PHP pob. Ua li no, hais kom meej cov ntawv nyob hauv cov lus txib nws tus kheej, piv txwv li, "5.6":

    sudo apt-tau nruab php5.6

Yog tias koj tsis xav tau tag nrho cov pob, koj tuaj yeem nruab cov modules sib cais los ntawm kev xaiv ua cov lus tseem ceeb:

sudo apt-tau nruab libapache2-mod-php5.6
sudo apt-tau nruab php5.6-fpm
sudo apt-tau nruab php5.6-cli
sudo apt-tau nruab php-gd
sudo apt-tau nruab php5.6-mbstring
sudo apt-tau nruab php5.6-mcrypt
sudo apt-mus nruab php5.6-mysql
sudo apt-tau nruab php5.6-xml

Xaus

Hauv kev xaus, peb tuaj yeem hais tias, txawm tias muaj qhov kev paub yooj yim txog kev ua haujlwm ntawm lub koos pis tawj, ib tus neeg siv tau yooj yim nruab ob lub ntsiab PHP pob thiab tag nrho nws cov khoom sib ntxiv. Lub ntsiab yog paub cov lus txib uas yuav tsum tau khiav ntawm Ubuntu Server.

Pin
Send
Share
Send