Skip to content
WasFor
Kgutlela hae
Litokomane/Sehlopha sa basebelisi

PHP nako ea ho sebetsa

Sebaka se seng le se seng se sebelisa mofuta oa PHP oo u o khethang. Ka holim'a phetolelo, WasFor e u lumella ho hlokomoloha litaelo tsa php.ini ka bomong ntle le ho ama boemo ba seva.

Khetha mofuta

Liwebsaete → sebaka → Litlhophiso → Mofuta oa PHP o thathamisa liphetolelo tse kentsoeng node. Ho e fetola ho ngola sokete ea FPM ea vhost hape ebe e kenya letamo leo feela - libaka tse ling li lula li sebeletsa.

text
PHP 8.1   Legacy applications
PHP 8.2   Current LTS-style choice
PHP 8.3   Recommended default

Bapisa mofuta oo moralo oa hau o o phatlalatsang. Ho tsamaisa moralo oa sejoale-joale ka nako ea khale ea ho matha ke sesosa se atileng haholo sa liphoso tse hlakileng tsa 500 kamora ho falla.

Mokhoa oa ho fetisa mosebetsi

Likarolo tse tharo li kopantsoe nakong ea ts'ebetso:

LeraMong'aMohlala
Boemo ba sevaMotsamaisimemory_limit = 128M
Sebaka sa marang-rang se tlositseMorekimemory_limit = 256M
Kopoini_set()Kopo ea tokiso

Taelo ke e futsitsoeng ho fihlela sebaka se se beha. Boleng bo fetelletseng ba null kapa senotlolo se siiloeng se bolela "ho lula u rua". Sena se etsa hore ho bolokehe ho fetola kamehla seva hamorao ntle le ho makatsa sebaka se seng le se seng.

Litaelo tse tšehelitsoeng

TataisoRangeEa kamehlaLintlha
memory_limit64M – 1G128ME amohela li-suffixes tsa M/G
max_execution_time30 – 30060Metsotsoana; 0 ha e lumelloe
max_input_time30 – 300, -160-1 e bolela se nang moeli
upload_max_filesize2M – 512M64ME tlameha ho ba ≤ post_max_size
post_max_size2M – 512M64ME tlameha ho ba ≥ boholo ba ho kenya
max_input_vars1000 – 100001000Phahamisa bakeng sa mefuta e meholo
display_errorsOn / OffOffBoloka Off tlhahisong
error_reportinglinomoro kapa E_*E_ALLE amohela E_ALL & ~E_DEPRECATED
date.timezoneLebitso la IANAUTCmohlala Asia/Shanghai
session.gc_maxlifetime1440 – 864001440Metsotsoana

Ho netefatsoa ho etsahala pele ntho leha e le efe e ngoloa. Theko e tsoileng tseleng e hanoa ka phoso ea lebala; ha ho mohla e tlamisoang ka khutso.

Laola tse tlositsoeng phanele

  1. Bula sebaka sena → PHP.
  2. Fetolela Fetola haufi le taelo.
  3. Kenya boleng 'me u boloke.
  4. Netefatsa phetoho kholomong ea E sebetsang.

Phanele e totobatsa litemoso tse joalo ka post_max_size ho ba nyane ho feta upload_max_filesize, e ka fokotsang ho kenya ka khutso.

Laola tse fetang ka API

http
GET /api/user/sites/42/php/settings
Authorization: Bearer <access-token>
json
{
  "ok": true,
  "data": {
    "php_version": "8.3",
    "runtime": "fpm",
    "supported": ["memory_limit", "max_execution_time", "upload_max_filesize"],
    "inherited": { "memory_limit": "128M", "max_execution_time": "60" },
    "overrides": { "memory_limit": "256M" },
    "effective": { "memory_limit": "256M", "max_execution_time": "60" },
    "limits": { "memory_limit": { "min": "64M", "max": "1G" } },
    "warnings": []
  }
}

Lintlafatso tsa ntlafatso ka ntho e itseng; linotlolo tseo u li siileng boloka boemo ba tsona ba hajoale:

http
PUT /api/user/sites/42/php/settings
Content-Type: application/json

{ "overrides": { "memory_limit": "256M", "display_errors": "Off" } }

Ho emisa ho tlola taelo, romella null:

json
{ "overrides": { "memory_limit": null } }

Seta sephetho se seng le se seng hape:

http
POST /api/user/sites/42/php/settings/reset

Etsa lethathamo la likeketso tse fumanehang ho mofuta o khethiloeng:

http
GET /api/user/sites/42/php/extensions

Lintlha tsa ts'ebetso

  • Litlaleho li ngoletsoe sekhechana sa php.ini sebakeng ka seng, eseng faeleng ea lefatše lohle.
  • max_execution_time ha e kenyelle nako e sebelisitsoeng ho thibela mehala ea sistimi; sebedisa motho ya sebetsang moleng bakeng sa mosebetsi o molelele.
  • upload_max_filesize le post_max_size li tlameha ho tsamaea hammoho. Beha post_max_size e kholoanyane hanyane.
  • Ka mor'a ho fetola error_reporting, hlahisa taba hape 'me u hlahlobe tlaleho ea phoso ea sebaka; display_errors e ama feela 'mele o arabelang.
  • Matamo a FPM a kentsoe bocha ka bokhabane. Likōpo tsa ka sefofaneng li qetella ka litlhophiso tsa khale.

Tse amanang

E qetetse ho ntlafatsoa: 2026-12-01