user217648
user217648

Reputation: 3486

Can't deploy PHP on dev emulator with Worker Role

I use Eclipse and plugins for PHP to create and configure my PHP project to deploy them on Windows Azure (WA). However, I have installed WA SDK 1.7 (7th Jun) and it is not compatible with Eclipse and the plugins so I had to use commando. I decided to create the project (with a web role and a worker role) in Eclipse and tried to run the following commando to recreate cscfg file and .csx folder and then run it on compute emulator...

 cspack ServiceDefinition.csdef /generateConfigurationFile:ServiceConfiguration.cscfg /copyonly

...but it generates following error...

Error : CloudServices38 : The entrypoint dll is not defined for worker role MyPhpProj_MyWorkerRole.

Thanks for your advice.

Upvotes: 2

Views: 620

Answers (1)

AvkashChauhan
AvkashChauhan

Reputation: 20576

In Web and Worker role you really need to either provide a role entrypoint or program entry point. And I know that in custom worker role there is no worker role DLL however you can use your PHP.EXE or Java.exe or Nodejs.exe as ProgramEntryPoint.

The way you will solve this problem is that using ProgramEntryPoint with your Windows Azure Worker Role. I will give you an example as below on how to use it so you can use in your Windows Azure PHP application:

So if you have your worker role name "TestWorker" and the folder TestWorker contains your PHP.EXE plus other files and your application folder looks as below:

enter image description here

Now you can also edit/add your ServiceDefinition.cscfg to include correct WorkerRole setting as well as ProgramEntryPoint as below:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="WorkerRoleApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-05.1.7">
 <WorkerRole name="TestWorker" vmsize="Small">
   <Runtime executionContext="limited">
     <EntryPoint>
      <ProgramEntryPoint commandLine="php.exe" setReadyOnProcessStart="true" />
     </EntryPoint>
   </Runtime>
   <Endpoints>
        <InputEndpoint name="PhpHttpIn" protocol="http" port="80" />
   </Endpoints>
  </WorkerRole>
</ServiceDefinition>

Finally you can use CSPACK command as below to build your Package and then test it locally in Compute Emulator:

cspack ServiceDefinition.csdef /role:TestWorker;TestWorker /copyOnly 
   /out:WorkerRoleApp.csx /generateConfigurationFile:ServiceConfiguration.cscfg

Finally the results look like as below:

enter image description here

Upvotes: 8

Related Questions