Tusaha Hagaajinta PHP ee Ubuntu Server

Horumarinta codsiyada webka ayaa laga yaabaa inay ku adkaato inay ku dhejiyaan luuqadda PHP-ka ee Ubuntu Server. Tani waxay sabab u tahay arrimo badan. Laakiin adigoo isticmaalaya tilmaan-bixiyahan, qof waliba wuu ka fogaan karaa khaladaadka marka la rakibayo

U samee PHP Ubuntu Server

Ku rakibidda luqadda PHP ee Ubuntu Server waxaa loo samayn karaa siyaabo kala duwan - waxay dhammaan ku xiran tahay nooca iyo qaabka nidaamka hawlgalka laftiisa. Farqiga ugu weyni waxa uu ku jiraa kooxaha, kuwaas oo u baahan doona inay qabtaan.

Waxaa sidoo kale mudan in la ogaado in xirmada PHP ay ka kooban tahay dhowr qaybood oo, haddii loo baahdo, si gooni ah loogu rakibi karo midba midka kale.

Habka 1aad: Qalabka Dayactirka

Kuraasta caadiga ah waxay ku lug leedahay isticmaalka nuqulkii ugu dambeeyay ee xirmada. Nidaam kasta oo hawlgalka Ubuntu Server waa mid ka duwan:

  • 12.04 LTS (Caddaan) - 5.3;
  • 14.04 LTS (Trusty) - 5.5;
  • Oct 15 (Wily) - 5.6;
  • 16.04 LTS (Xenial) - 7.0.

Dhammaan baakooyinka waxaa loo qaybiyaa habka rasmiga ah ee nidaamka hawlgalka, markaa uma baahnid inaad ku xirto cid saddexaad. Laakiin rakibaadda xirmada buuxda waxaa lagu fuliyaa laba nooc waxayna ku xiran tahay nooca OS. Sidaas, si aad u gashato PHP on Ubuntu Server 16.04, maamula qaynuunkan:

sudo apt-get install php

Iyo qoraaladii hore:

sudo apt-get install php5

Haddii aadan u baahneyn dhammaan qaybaha baakadka PHP ee nidaamka, waxaad si gaar ah u rakibi kartaa. Sidee loo sameeyaa tan iyo waxa amraya baahida loo qabo in la fuliyo, hoos lagu sharxi doono.

Apache HTTP Server Module

Si aad ugu rakibatid moduleka PHP ee Apache ee Ubuntu Server 16.04, waxaad u baahan tahay inaad raacdo amarada soo socda:

sudo apt-get install libapache2-mod-php

Wicitaanada hore ee OS-ga:

sudo apt-get install libapache2-mod-php5

Waxaa lagaa codsan doonaa lambar sir ah, ka dib markaad soo gasho kaas oo ah inaad ku siiso ogolaansho rakibidda. Si aad tan u sameyso, geli warqadda "D" ama "Y" (iyada oo ku xidhan xajinta Ubuntu Server) oo guji Gali.

Waxay weli ku sugantahay oo keliya in la sugo dhamaystirka xirmadda download iyo rakibida.

FPM

Si aad u rakibtid nidaamka FPM ee nidaamka hawlgalka ee version 16.04, samee waxyaabaha soo socda:

sudo apt-get install php-fpm

Qoraalada hore:

sudo apt-get install php5-fpm

Xaaladdan, rakibidda ayaa si toos ah u bilaabi doonta, isla markiiba ka dib markaad soo gasho erayga sirta ah.

CLI

CLI waa lagama maarmaan u ah horumarinta kuwa ku hawlan sameynta barnaamijyada konsole ee PHP. Si aad uqoreeysid luqaddan barnaamijka aadka u ah, Ubuntu 16.04 waxaad u baahan tahay inaad fuliso amarka:

sudo apt-get install php-cli

Qoraalada hore:

sudo apt-get install php5-cli

Kordhinta PHP

Si loo hirgaliyo dhammaan hawlaha PHP, waxaa lagama maarmaan ah in lagu rakibo tiro fara badan oo barnaamijyada loo isticmaalo. Hadda amarrada ugu caansan ee lagu fulinayo qalabka noocan oo kale ah ayaa la soo bandhigi doonaa.

Fiiro gaar ah: kuwan soo socda ayaa la siin doonaa kordhin kasta oo leh laba amar, halka ugu horeysa ee loogu talagalay Ubuntu Server 16.04, iyo kan labaadna waxaa loogu talagalay qaababka hore ee OS.

  1. Kordhinta GD:

    sudo apt-get install php-gd
    sudo apt-get install php5-gd

  2. Kordhinta Mcrypt:

    sudo apt-get install php-mcrypt
    sudo apt-get install php5-mcrypt

  3. Kordhinta MySQL:

    sudo apt-get install php-mysql
    sudo apt-get install php5-mysql

Eeg sidoo kale: Tusaha Xidhiidhinta MySQL ee Ubuntu

Habka 2aad: Ku rakib Versiyon kale

Waxaa la sheegay in ka badan in xirmada PHP ee ku habboon lagu rakibi doono nooc kasta oo ah Ubuntu Server. Hase yeeshe, tan kama horjoogsan karto suurtagalnimada in la dhiso horay ama, liddi ku ah, kaddibna luuqadda barnaamijka.

  1. Marka hore waxaad u baahan tahay inaad ka saarto dhammaan qaybaha PHP kuwaas oo horay loogu rakibay nidaamka. Si tan loo sameeyo Ubuntu 16.04 waxay ku maamulaan labo amar:

    sudo apt-get rid libapache2-mod-php php-fpm php-cli php-gd php-mcrypt php-mysql
    sudo apt-get autoremove

    Wicitaanada hore ee OS-ga:

    sudo apt-get rid libapache2-mod-php5 php5-fpm php5-cli php5-gd php5-mcrypt php5-mysql
    sudo apt-get autoremove

  2. Hadda waxaad u baahan tahay inaad ku darto PPA liiska bakhaarooyinka, kuwaas oo ka kooban baakooyinka dhammaan noocyada PHP:

    sudo add-apt-repository ppa: ondrej / php
    sudo apt-get update

  3. Waqtigan xaadirka ah, waxaad ku xiran kartaa xirmadda PHP dhamaystiran. Si arrintan loo sameeyo, koox ahaan lafteeda, cadee tusaalaha, tusaale ahaan, "5.6":

    sudo apt-get install php5.6

Haddii aadan u baahneyn xirmo dhamaystiran, waxaad kuxirin kartaa nidaamyada si gooni ah adigoo si xushmad leh u fulinaya amarrada lagama maarmaanka ah:

sudo apt-get install libapache2-mod-php5.6
sudo apt-get install php5.6-fpm
sudo apt-get install php5.6-cli
sudo apt-get install php-gd
sudo apt-get install php5.6-mbstring
sudo apt-get install php5.6-mcrypt
sudo apt-get install php5.6-mysql
sudo apt-get install php5.6-xml

Gabagabo

Ugu dambeyn, waxaan dhihi karnaa, xitaa aqoonta aasaasiga ah ee ka shaqeynta kumbuyuutarka, isticmaaluhu wuxuu si sahlan u rakibi karaa xirmoka ugu muhiimsan ee PHP iyo qaybaha kale ee dheeraadka ah. Waxyaabaha ugu muhiimsan waa in la ogaado amarrada aad u baahan tahay in lagu ordo Ubuntu Server.