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.
PHP 8.1 Legacy applications
PHP 8.2 Current LTS-style choice
PHP 8.3 Recommended defaultBapisa 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
500kamora ho falla.
Mokhoa oa ho fetisa mosebetsi
Likarolo tse tharo li kopantsoe nakong ea ts'ebetso:
| Lera | Mong'a | Mohlala |
|---|---|---|
| Boemo ba seva | Motsamaisi | memory_limit = 128M |
| Sebaka sa marang-rang se tlositse | Moreki | memory_limit = 256M |
| Kopo | ini_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
| Tataiso | Range | Ea kamehla | Lintlha |
|---|---|---|---|
memory_limit | 64M – 1G | 128M | E amohela li-suffixes tsa M/G |
max_execution_time | 30 – 300 | 60 | Metsotsoana; 0 ha e lumelloe |
max_input_time | 30 – 300, -1 | 60 | -1 e bolela se nang moeli |
upload_max_filesize | 2M – 512M | 64M | E tlameha ho ba ≤ post_max_size |
post_max_size | 2M – 512M | 64M | E tlameha ho ba ≥ boholo ba ho kenya |
max_input_vars | 1000 – 10000 | 1000 | Phahamisa bakeng sa mefuta e meholo |
display_errors | On / Off | Off | Boloka Off tlhahisong |
error_reporting | linomoro kapa E_* | E_ALL | E amohela E_ALL & ~E_DEPRECATED |
date.timezone | Lebitso la IANA | UTC | mohlala Asia/Shanghai |
session.gc_maxlifetime | 1440 – 86400 | 1440 | Metsotsoana |
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
- Bula sebaka sena → PHP.
- Fetolela Fetola haufi le taelo.
- Kenya boleng 'me u boloke.
- 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
GET /api/user/sites/42/php/settings
Authorization: Bearer <access-token>{
"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:
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:
{ "overrides": { "memory_limit": null } }Seta sephetho se seng le se seng hape:
POST /api/user/sites/42/php/settings/resetEtsa lethathamo la likeketso tse fumanehang ho mofuta o khethiloeng:
GET /api/user/sites/42/php/extensionsLintlha tsa ts'ebetso
- Litlaleho li ngoletsoe sekhechana sa
php.inisebakeng ka seng, eseng faeleng ea lefatše lohle. max_execution_timeha e kenyelle nako e sebelisitsoeng ho thibela mehala ea sistimi; sebedisa motho ya sebetsang moleng bakeng sa mosebetsi o molelele.upload_max_filesizelepost_max_sizeli tlameha ho tsamaea hammoho. Behapost_max_sizee kholoanyane hanyane.- Ka mor'a ho fetola
error_reporting, hlahisa taba hape 'me u hlahlobe tlaleho ea phoso ea sebaka;display_errorse 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
- Liwebsaete bakeng sa li-vhosts le deployment
- Mosebelisi API bakeng sa tšupiso e felletseng ea lintlha
- Tharollo ea mathata ha phetoho e baka
502