Otsatsa mapulogalamu a webusaiti angakhale ovuta kukhazikitsa chinenero cha PHP ku Ubuntu Server. Izi ndi chifukwa cha zinthu zambiri. Koma pogwiritsira ntchito ndondomekoyi, aliyense angapewe zolakwa panthawi yoikidwa.
Ikani PHP ku Ubuntu Server
Kuyika chilankhulo cha PHP ku Ubuntu Server kungakhoze kuchitidwa m'njira zosiyanasiyana - izo zimadalira mtundu wake ndi momwe ntchitoyo ikuyendera. Ndipo kusiyana kwakukulu kuli mu magulu okha, omwe adzafunika kuchita.
Ndiyeneranso kuzindikira kuti phukusi la PHP lili ndi zigawo zingapo zomwe, ngati zingatheke, zikhoza kukhazikitsidwa mosiyana.
Njira 1: Kuyika Kwambiri
Kukonzekera kwakukulu kumaphatikizapo kugwiritsa ntchito mapangidwe atsopano a phukusi. Ubuso Server iliyonse ikuthandizira:
- 12.04 LTS (Zenizeni) - 5.3;
- 14.04 LTS (odalirika) - 5.5;
- Oct 15 (Wily) - 5.6;
- 16.04 LTS (Xenial) - 7.0.
Phukusi lonseli likugawidwa kudzera mu malo apamwamba a machitidwe, choncho simusowa kulumikizana ndi munthu wina. Koma kuyika kwa phukusi lathunthu kumachitika m'mawonekedwe awiri ndipo zimadalira kusintha kwa OS. Choncho, kukhazikitsa PHP pa Ubuntu Server 16.04, pangani lamulo ili:
sudo apt-get install php
Ndipo kwa zaka zoyambirira:
sudo apt-get install php5
Ngati simukusowa zigawo zonse za pulogalamu ya PHP m'dongosolo, mukhoza kuziyika mosiyana. Momwe mungachitire izi ndi malamulo omwe mukufunikira kuchita, adzafotokozedwa pansipa.
Apache HTTP Server Module
Kuyika gawo la PHP la Apache ku Ubuntu Server 16.04, muyenera kuyendetsa lamulo ili:
sudo apt-get kukhazikitsa libapache2-mod-php
M'masinthidwe oyambirira a OS:
sudo apt-get kukhazikitsa libapache2-mod-php5
Mudzafunsidwa kuti mukhale ndi mawu achinsinsi, mutatha kulowa mmalo momwe mungapereke chilolezo cha kuikidwa. Kuti muchite izi, lowetsani kalata "D" kapena "Y" (malingana ndi malo enieni a Ubuntu Server) ndipo dinani Lowani.
Zimangokhala ndikudikirira kukwaniritsa phukusi lothandizira ndi kuika.
FPM
Kuyika gawo la FPM mu njira yoyendetsera version 16.04, chitani zotsatirazi:
sudo apt-get install php-fpm
M'masinthidwe oyambirira:
sudo apt-get install php5-fpm
Pachifukwa ichi, kuyimitsidwa kudzayamba mosavuta, mwamsanga mutangotulukira mawu achinsinsi.
CLI
CLI ndi yofunikira kwa omanga omwe akugwira nawo ntchito yolenga mapulogalamu a PHP. Kuti mulowe chinenero ichi, mu Ubuntu 16.04 muyenera kuchita lamulo:
sudo apt-get install php-cli
M'masinthidwe oyambirira:
sudo apt-get kukhazikitsa php5-cli
Zowonjezera za PHP
Pofuna kugwira ntchito zonse zomwe zingatheke ku PHP, m'pofunikira kukhazikitsa zoonjezera zambiri pa mapulogalamu ogwiritsidwa ntchito. Tsopano malamulo omwe amadziwika kwambiri pochita maimidwe oterowo adzaperekedwa.
Zindikirani: zotsatirazi zidzaperekedwa pazowonjezereka zonse ndi malamulo awiri, pomwe yoyamba ndi ya Ubuntu Server 16.04, ndipo yachiwiri ndizoyambirira za OS.
- Kuwonjezera kwa GD:
sudo apt-get install php-gd
sudo apt-get install php5-gd
- Kuwonjezera kwa Mcrypt:
sudo apt-get install php-mcrypt
sudo apt-get install php5-mcrypt
- Kutsatsa MySQL:
sudo apt-get install php-mysql
sudo apt-get install php5-mysql
Onaninso: MySQL Installation Guide ya Ubuntu
Njira 2: Sakani Zowonjezera Zina
Zanenedwa pamwambapa kuti phukusi lofanana la PHP lidzaikidwa mu Ubuntu Server iliyonse. Koma izi sizikutanthauza kuti ndizotheka kukhazikitsa poyamba kapena, mosiyana, pambuyo pake pulogalamu ya pulogalamu.
- Choyamba muyenera kuchotsa zipangizo zonse za PHP zomwe zinakhazikitsidwa poyamba. Kuchita izi mu Ubuntu 16.04 kumapanga malamulo awiri:
chotsani-chotsani libapache2-mod-php php-fpm php-cli php-gd php-mcrypt php-mysql
sudo apt-get autoremoveM'masinthidwe oyambirira a OS:
sudo apt-get kuchotsa libapache2-mod-php5 php5-fpm php5-cli php5-gd php5-mcrypt php5-mysql
sudo apt-get autoremove - Tsopano mukufunika kuwonjezera PPA ku mndandanda wa zosungiramo zinthu, zomwe zili ndi mapepala a Mabaibulo onse a PHP:
sudo add-apt-repository ppa: ondrej / php
sudo apt-get update - Pano, mukhoza kukhazikitsa phukusi lathunthu la PHP. Kuti muchite izi, mu timu yokha, tchulani malemba ake, mwachitsanzo, "5.6":
sudo apt-get install php5.6
Ngati simukusowa phukusi lathunthu, mukhoza kukhazikitsa ma modules pokhapokha mutachita malamulo oyenera:
sudo apt-get kukhazikitsa 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
Kutsiliza
Pomalizira, tingathe kunena kuti, pokhala ndi chidziwitso chakugwira ntchito pamakompyuta, wogwiritsa ntchito akhoza kuyika zonse phukusi lalikulu la PHP ndi zigawo zake zonse zina. Chinthu chachikulu ndicho kudziwa malamulo omwe mukufunikira kuti mutumikire mu Ubuntu Server.