Tôi đã gặp phải hành vi kỳ lạ của việc triển khai webrure azure php, mỗi lần triển khai thứ hai khi tôi duyệt trang hiển thị lỗi 500, nhưng nếu tôi xuất bản lại mà không có bất kỳ thay đổi nào đã cố tìm nội dung nào đó trong trình xem sự kiện nhưng không có gì làAzure php webrole lỗi ngẫu nhiên 500 khi triển khai
Một số thông tin gỡ lỗi: Khi lỗi đó xảy ra, tôi đã kiểm tra cấu hình IIS bằng máy tính từ xa Tôi đã nhận thấy rằng trình xử lý PHP có đường dẫn sai được chỉ định chẳng hạn F: \ wwwroot \ bin \ php \ php-cgi.exe nhưng trên máy chủ đường dẫn thực là E: \ wwwroot \ bin \ php \ php-cgi.exe Tôi nghĩ rằng ký tự ổ đĩa (F :) theo sau từ hệ thống của tôi từ nơi tôi xuất bản NHƯNG, như tôi đã nói lạ là một lần nó hoạt động nhưng khi tôi xuất bản lại nó hơn lỗi xảy ra ...
setup_web.cmd (tôi đã sao chép nó từ https://azure.microsoft.com/en-us/documentation/articles/cloud-services-php-create-web-role/)
@ECHO ON
cd "%~dp0"
if "%EMULATED%"=="true" exit /b 0
msiexec /i sqlncli.msi /qn IACCEPTSQLNCLILICENSETERMS=YES
SET PHP_FULL_PATH=%~dp0php\php-cgi.exe
SET NEW_PATH=%PATH%;%RoleRoot%\base\x86
%WINDIR%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%PHP_FULL_PATH%',maxInstances='12',idleTimeout='60000',activityTimeout='3600',requestTimeout='60000',instanceMaxRequests='10000',protocol='NamedPipe',flushNamedPipe='False']" /commit:apphost
%WINDIR%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%PHP_FULL_PATH%'].environmentVariables.[name='PATH',value='%NEW_PATH%']" /commit:apphost
%WINDIR%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%PHP_FULL_PATH%'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']" /commit:apphost
%WINDIR%\system32\inetsrv\appcmd.exe set config -section:system.webServer/handlers /+"[name='PHP',path='*.php',verb='GET,HEAD,POST,OPTIONS',modules='FastCgiModule',scriptProcessor='%PHP_FULL_PATH%',resourceType='Either',requireAccess='Script']" /commit:apphost
%windir%\system32\inetsrv\appcmd.exe set config /section:urlCompression /doDynamicCompression:True /commit:apphost
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json; charset=utf-8',enabled='True']" /commit:apphost
%WINDIR%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /"[fullPath='%PHP_FULL_PATH%'].queueLength:50000"
CẬP NHẬT: Sau khi khắc phục sự cố này, tôi nghĩ rằng vấn đề đang xảy ra sau: Tôi có thư mục dự án trên ổ E: \, khi xuất bản lần đầu tiên tạo E: \ drive và đặt đường dẫn xử lý php bằng lệnh ghép ngắn, nhưng khi tôi xuất bản một lần nữa xóa xanh lái xe E: \ và tạo ổ đĩa F: \ và cố gắng confugre IIS lại chút so với nó ném lỗi sau đây:
F:\approot\bin>cd "F:\approot\bin\"
F:\approot\bin>if "false" == "true" exit /b 0
F:\approot\bin>msiexec /i sqlncli.msi /qn IACCEPTSQLNCLILICENSETERMS=YES
F:\approot\bin>SET PHP_FULL_PATH=F:\approot\bin\php\php-cgi.exe
F:\approot\bin>SET NEW_PATH=D:\Windows\system32;D:\Windows;D:\Windows\System32\Wbem;D:\Windows\System32\WindowsPowerShell\v1.0\;;F:\base\x64;F:\base\x86;;D:\Packages\GuestAgent\GuestAgent\LegacyRuntime\x64;D:\Packages\GuestAgent\GuestAgent\LegacyRuntime\x86;;F:\base\x86
F:\approot\bin>D:\Windows\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='F:\approot\bin\php\php-cgi.exe',maxInstances='12',idleTimeout='60000',activityTimeout='3600',requestTimeout='60000',instanceMaxRequests='10000',protocol='NamedPipe',flushNamedPipe='False']" /commit:apphost
ERROR (message:New application object missing required attributes. Cannot add duplicate collection entry of type 'application' with combined key attributes 'fullPath, arguments' respectively set to 'F:\approot\bin\php\php-cgi.exe, '
.)
F:\approot\bin>D:\Windows\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='F:\approot\bin\php\php-cgi.exe'].environmentVariables.[name='PATH',value='D:\Windows\system32;D:\Windows;D:\Windows\System32\Wbem;D:\Windows\System32\WindowsPowerShell\v1.0\;;F:\base\x64;F:\base\x86;;D:\Packages\GuestAgent\GuestAgent\LegacyRuntime\x64;D:\Packages\GuestAgent\GuestAgent\LegacyRuntime\x86;;F:\base\x86']" /commit:apphost
ERROR (message:New environmentVariable object missing required attributes. Cannot add duplicate collection entry of type 'environmentVariable' with unique key attribute 'name' set to 'PATH'
.)
F:\approot\bin>D:\Windows\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='F:\approot\bin\php\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']" /commit:apphost
ERROR (message:New environmentVariable object missing required attributes. Cannot add duplicate collection entry of type 'environmentVariable' with unique key attribute 'name' set to 'PHP_FCGI_MAX_REQUESTS'
.)
F:\approot\bin>D:\Windows\system32\inetsrv\appcmd.exe set config -section:system.webServer/handlers /+"[name='PHP',path='*.php',verb='GET,HEAD,POST,OPTIONS',modules='FastCgiModule',scriptProcessor='F:\approot\bin\php\php-cgi.exe',resourceType='Either',requireAccess='Script']" /commit:apphost
ERROR (message:New add object missing required attributes. Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'PHP'
.)
F:\approot\bin>D:\Windows\system32\inetsrv\appcmd.exe set config /section:urlCompression /doDynamicCompression:True /commit:apphost
Applied configuration changes to section "system.webServer/urlCompression" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"
F:\approot\bin>D:\Windows\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json; charset=utf-8',enabled='True']" /commit:apphost
ERROR (message:New add object missing required attributes. Cannot add duplicate collection entry of type 'add' with unique key attribute 'mimeType' set to 'application/json; charset=utf-8'
.)
F:\approot\bin>D:\Windows\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /"[fullPath='F:\approot\bin\php\php-cgi.exe'].queueLength:50000"
Applied configuration changes to section "system.webServer/fastCgi" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"
vì vậy, tôi đoán nó có thể \ 't thiết lập cấu hình của php bởi vì nó đã được thiết lập và do đó ném các lỗi trùng lặp
Vì vậy, tôi cần một cái gì đó như thế này: hoặc làm cho các ký tự ổ đĩa không thay đổi khi xuất bản hoặc thay đổi tập lệnh cấu hình bằng cách sử dụng followi ng kịch bản: đầu tiên loại bỏ cấu hình IIS hiện có để tránh lỗi trùng lặp và hơn thêm nó một lần nữa.
Phiên bản PHP của bạn được sử dụng trong dịch vụ đám mây là gì? Và theo một câu hỏi khác của bạn http://stackoverflow.com/questions/35357846/change-document-root-on-azure-php-webrole, liều vấn đề này xảy ra trong ứng dụng ấu trùng? bạn sử dụng phiên bản ấu trùng nào? Vì hơi khó để tái tạo vấn đề này ở bên cạnh tôi. –
Có nó xảy ra trong ứng dụng Laravel, tôi đang sử dụng php 5.6 – Phoebus
Một điều mà tôi đã nhận thấy là, khi tôi xuất bản gói và lỗi xảy ra xử lý php trong cấu hình IIS có đường dẫn sai quy định – Phoebus