Phangizo Lakuyika kwa PHP pa Ubuntu Server

Pin
Send
Share
Send

Madongosolo opanga mawebusayitowa amatha kukhala zovuta kukhazikitsa chilankhulo cha PHP pa Ubuntu Server. Izi ndichifukwa cha zinthu zambiri. Koma kugwiritsa ntchito kalozerayu, aliyense adzitha kupewa zolakwa pakuika.

Kukhazikitsa PHP ku Ubuntu Server

Kukhazikitsa chilankhulo cha PHP mu Ubuntu Server chitha kuchitidwa m'njira zosiyanasiyana - zonse zimatengera mtundu wake ndi mtundu wa pulogalamu yoyendetsera yokha. Ndipo kusiyana kwakukulu kumagona m'maguluwo, omwe amafunika kuphedwa.

Ndizofunikanso kudziwa kuti phukusi la PHP limaphatikizapo zinthu zingapo zomwe, ngati zingafune, zitha kukhazikitsidwa mosiyana ndi mzake.

Njira 1: Kukhazikitsa Kwambiri

Kukhazikitsa koyenera kumakhudzanso kugwiritsa ntchito mtundu wamakono wa phukusi. Munjira iliyonse yogwira ntchito ya Ubuntu Server, ndizosiyana:

  • 12.04 LTS (Yabwino) - 5.3;
  • 14.04 LTS (Trusty) - 5.5;
  • 15.10 (Wily) - 5.6;
  • 16.04 LTS (Xenial) - 7.0.

Phukusi lonse limagawidwa kudzera posungira boma la system, kotero simuyenera kulumikizana ndi gulu lachitatu. Koma kukhazikitsa phukusi lathunthu kumachitika m'mitundu iwiri ndipo zimatengera mtundu wa OS. Chifukwa chake, kukhazikitsa PHP pa Ubuntu Server 16.04, yendetsani lamulo ili:

sudo apt-kukhazikitsa php

Ndi zam'mbuyomu:

sudo apt-kukhazikitsa php5

Ngati simukufuna mbali zonse za phukusi la PHP mu pulogalamu, mutha kuzikhazikitsa mosiyana. Momwe mungachitire izi komanso zomwe zikulamula kuchita izi zikuyenera kufotokozedwa pansipa.

Module ya Apache HTTP Server

Kukhazikitsa gawo la PHP la Apache pa Ubuntu Server 16.04, muyenera kuthamangitsa lamulo ili:

sudo apt-kukhazikitsa libapache2-mod-php

M'mitundu yakale ya OS:

sudo apt-kukhazikitsa libapache2-mod-php5

Mudzafunsidwa achinsinsi, mutalowa kumene muyenera kupereka chilolezo kukhazikitsa. Kuti muchite izi, lembani kalata D kapena "Y" (kutengera kutengera kwa Ubuntu Server) ndikudina Lowani.

Zomwe zimatsala ndikudikirira kutsitsa ndi kukhazikitsa kuti zithe.

FPM

Kukhazikitsa FPM pa pulogalamu yogwiritsira ntchito 16.04, chitani izi:

sudo apt-kukhazikitsa php-fpm

M'mitundu yakale:

sudo apt-kukhazikitsa php5-fpm

Pankhaniyi, kuyika kumayamba zokha, mutangolowa mawu achinsinsi a superuser.

CLI

CLI ndiyofunikira kwa opanga omwe amapanga mapulogalamu a console mu PHP. Kuti mukwaniritse chilankhulochi, mu Ubuntu 16.04 muyenera kuyendetsa:

sudo apt-kukhazikitsa php-lia

M'mitundu yakale:

sudo apt-kukhazikitsa php5-ent

PHP zowonjezera

Kukhazikitsa ntchito zonse zomwe zingatheke pa PHP, ndikofunikira kukhazikitsa zowonjezera zingapo pamapulogalamu omwe agwiritsidwa ntchito. Tsopano malamulo odziwika kwambiri a kukhazikitsa motere aperekedwa.

Chidziwitso: Pansipa, malamulo awiri adzaperekedwa pakuwonjezera kulikonse, pomwe yoyamba ndi Ubuntu Server 16.04, ndipo yachiwiri ndi ya mitundu yoyambirira ya OS.

  1. Kukula kwa GD:

    sudo apt-kukhazikitsa php-gd
    sudo apt-kukhazikitsa php5-gd

  2. Kukula kwa Mcrypt:

    sudo apt-kukhazikitsa php-mcrypt
    sudo apt-kukhazikitsa php5-mcrypt

  3. Kukula kwa MySQL:

    sudo apt-kukhazikitsa php-mysql
    sudo apt-kukhazikitsa php5-mysql

Onaninso: Upangiri Wanga wa MySQL pa Ubuntu

Njira 2: Ikani Mavesi Ena

Zinanenedwa pamwambapa kuti muma mtundu uliwonse wa Ubuntu Server phukusi lolingana la PHP lidzayikiridwa. Koma izi sizikuchepetsa mphamvu yakukhazikitsa choyambirira kapena, mosinthira, mtundu wamtsogolo wa chilankhulocho.

  1. Choyamba muyenera kuchotsa zigawo zonse za PHP zomwe zidakhazikitsidwa kale pazinthu. Kuti muchite izi, yendetsani malamulo awiri pa Ubuntu 16.04:

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

    M'mitundu yakale ya OS:

    sudo apt-chotsani libapache2-mod-php5 php5-fpm php5-memb php5-gd php5-mcrypt php5-mysql
    sudo apt-get autoremove

  2. Tsopano mukuyenera kuwonjezera PPA mndandanda wazosunga, zomwe zimakhala ndi mitundu yonse ya PHP:

    sudo yowonjezera-apt-repository ppa: ondrej / php
    kukonda kwambiri

  3. Pakadali pano, mutha kukhazikitsa phukusi lonse la PHP. Kuti muchite izi, tchulani mtunduwo mu lamulo lokha, mwachitsanzo, "5.6":

    sudo apt-kukhazikitsa php5.6

Ngati simukufuna phukusi lathunthu, mutha kukhazikitsa ma module pokhapokha pomvera malamulo oyenera:

sudo apt-kukhazikitsa libapache2-mod-php5.6
sudo apt-kukhazikitsa php5.6-fpm
sudo apt-kukhazikitsa php5.6 -aweni
sudo apt-kukhazikitsa php-gd
sudo apt-kukhazikitsa php5.6-mbstring
sudo apt-kukhazikitsa php5.6-mcrypt
sudo apt-kukhazikitsa php5.6-mysql
sudo apt-kukhazikitsa php5.6-xml

Pomaliza

Pomaliza, titha kunena kuti, ngakhale atakhala ndi chidziwitso chogwira ntchito pakompyuta, wogwiritsa ntchito amatha kukhazikitsa phukusi lalikulu la PHP ndi zina zonse zowonjezera. Chachikulu ndikudziwa malamulo omwe amafunikira kuyendetsedwa pa Ubuntu Server.

Pin
Send
Share
Send