Masu samar da aikace-aikacen yanar gizo na iya zama matsala wajen shigar da harshen rubutun PHP a cikin Ubuntu Server. Wannan shi ne saboda dalilai masu yawa. Amma ta amfani da wannan jagorar, kowa na iya kauce wa kuskure a lokacin shigarwa.
Shigar PHP a cikin Ubuntu Server
Tsarin harshe na PHP a cikin Ubuntu Server za a iya aikatawa a hanyoyi daban-daban - duk ya dogara ne da fasalinta da kuma tsarin tsarin aiki kanta. Kuma babban bambanci ya kasance a cikin teams da kansu, wanda zai buƙaci yi.
Har ila yau, ya kamata a lura cewa ƙunshin lamarin na PHP ya haɗa da abubuwa da yawa waɗanda, idan an so, za a iya sanya su daban daga juna.
Hanyar 1: Tabbataccen Shigarwa
Tabbataccen shigarwa ya haɗa da yin amfani da sabuwar fitowar ta kunshin. Kowane tsarin aiki Ubuntu Server shi ne daban-daban:
- 12.04 LTS (Precise) - 5.3;
- 14.04 LTS (Trusty) - 5.5;
- Oct 15 (Wily) - 5.6;
- 16.04 LTS (Xenial) - 7.0.
Ana rarraba duk kunshin ta hanyar wurin ajiyar ma'aikata na tsarin aiki, don haka baza ku buƙaci haɗi da wani ɓangare na uku ba. Amma shigarwa na cikakken kunshin yana aiki ne a cikin nau'i biyu kuma ya dogara da tsarin OS. Saboda haka, don shigar da PHP akan Ubuntu Server 16.04, gudanar da wannan umurnin:
sudo apt-samun shigar php
Kuma ga tsoffin asali:
sudo apt-samun shigar php5
Idan ba ka buƙatar dukkanin ɓangarorin PHP a cikin tsarin, zaka iya shigar da su daban. Yadda za a yi wannan kuma wane umurni ga wannan bukatar da za a yi, za a bayyana a kasa.
Apache HTTP Server Module
Don shigar da PHP madauki don Apache a cikin Ubuntu Server 16.04, kana buƙatar gudu da wadannan umurnin:
sudo apt-samun shigar libapache2-mod-php
A cikin sassan farko na OS:
sudo apt-samun shigar libapache2-mod-php5
Za a nemika don kalmar sirri, bayan shigar da dole ne ka ba izini don shigarwa. Don yin wannan, shigar da wasika "D" ko "Y" (dangane da localization of Ubuntu Server) kuma danna Shigar.
Ya rage kawai don jira don kammala aikin saukewa da shigarwa.
FPM
Don shigar da tsarin FPM a cikin tsarin aiki na 16.04, yi kamar haka:
sudo apt-samun shigar php-fpm
A cikin sassan da suka gabata:
sudo apt-samun shigar php5-fpm
A wannan yanayin, shigarwar za ta fara ta atomatik, nan da nan bayan shigar da kalmar sirri mai girma.
CLI
CLI wajibi ne ga masu haɓakawa da suka shiga cikin shirye-shiryen wasanni a cikin PHP. Don shigar da wannan harshe mai mahimmanci a ciki, a cikin Ubuntu 16.04 kana buƙatar aiwatar da umurnin:
sudo apt-samun shigar php-cli
A cikin sassan da suka gabata:
sudo apt-samun shigar php5-cli
PHP kari
Don aiwatar da dukkan ayyukan PHP, yana da muhimmanci don shigar da dama kari don shirye-shiryen da aka yi amfani da su. Yanzu za a gabatar da umarnin mafiya amfani don yin wannan shigarwa.
Lura: za a bayar da wadannan ga kowane tsawo tare da umarni guda biyu, inda aka fara don Ubuntu Server 16.04, kuma na biyu shine na farkon OS.
- Ƙarawa ga GD:
sudo apt-samun shigar php-gd
sudo apt-samun shigar php5-gd
- Ƙarawa ga Mcrypt:
sudo apt-samun shigar php-mcrypt
sudo apt-samun shigar php5-mcrypt
- MySQL tsawo:
sudo apt-samun shigar php-mysql
sudo apt-samun shigar php5-mysql
Duba kuma: Shirin Taimako na MySQL don Ubuntu
Hanyar 2: Shigar da Sauran Sauran
An ce a sama cewa za a shigar da nauyin kunshin PHP daidai a kowane ɗayan Ubuntu Server. Amma wannan ba ya hana yiwuwar shigarwa a baya ko, a akasin haka, daga baya wani harshe na shirye-shirye.
- Da farko kana buƙatar cire dukkan abubuwan da aka gyara na PHP wanda aka sanya a baya akan tsarin. Don yin wannan a cikin Ubuntu 16.04 gudu biyu dokokin:
sudo apt-samun cire libapache2-mod-php php-fpm php-cli php-gd php-mcrypt php-mysql
sudo apt-samun autoremoveA cikin sassan farko na OS:
sudo apt-cire cire libapache2-mod-php5 php5-fpm php5-cli php5-gd php5-mcrypt php5-mysql
sudo apt-samun autoremove - Yanzu kana buƙatar ƙara PPA zuwa jerin kayan ajiya, wanda ya ƙunshi nau'i na dukkan nauyin PHP:
sudo add-apt-repository ppa: ondrej / php
sudo apt-samun sabuntawa - A wannan lokaci, za ka iya shigar da cikakkun nauyin kunshin PHP. Don yin wannan, saka jerin version na umurnin kanta, misali "5.6":
sudo apt-samun shigar php5.6
Idan ba ku buƙatar cikakken kunshin ba, za ku iya shigar da kayayyaki ta daban ta hanyar yin amfani da umarnin da suka dace:
sudo apt-samun shigar libapache2-mod-php5.6
sudo apt-samun shigar php5.6-fpm
sudo apt-samun shigar php5.6-cli
sudo apt-samun shigar php-gd
sudo apt-samun shigar php5.6-mbstring
sudo apt-samun shigar php5.6-mcrypt
sudo apt-samun shigar php5.6-mysql
sudo apt-samun shigar php5.6-xml
Kammalawa
A ƙarshe, zamu iya cewa, tun da mahimmin ilimin aikin aiki a kwamfuta, mai amfani zai iya shigarwa duka babban fayil na PHP kuma dukkan sauran kayan aikinsa. Babban abu shine sanin dokokin da kake buƙatar gudu a cikin Ubuntu Server.