I had moved offices and started getting this error every time I tried to deploy a PHP cloud service directly using the Powershell Scripts. It took me a whole morning to fix but using Fiddler, I noticed that there was a timeout occurring during upload. This timeout is not reported directly by the script but it retries and when it ultimately fails, you get an error like this:

PS C:\projects\fws2> Publish-AzureServiceProject
VERBOSE: Publishing  to Windows Azure. This may take several minutes...
VERBOSE: 02:15:02 - Preparing runtime deployment for service 'fws2'
VERBOSE: 02:15:02 - Preparing deployment for socket with Subscription ID:
GUID...
VERBOSE: 02:15:25 - Connecting...
VERBOSE: 02:15:33 - Uploading Package to storage service xxx...
Publish-AzureServiceProject : The remote server returned an error: (500) Internal Server Error.
At line:1 char:1
+ Publish-AzureServiceProject
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Publish-AzureServiceProject], StorageException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.CloudService.Cmdlet.PublishAzureServiceProjectCommand

I don't know if/how you could adjust the timeout or get it to report a much more useful error to the user. This happened because our new office has much slower upload speed than the old office and the timeout is only 90 seconds.

The workaround is not to use the Powershell script Publish-AzureServiceProject but to manually update the deployment from the Azure management portal by browsing to the local cloud_package.cspkg and ServiceConfiguration.Cloud.cscfg files. For reference, Visual Studio uses chunk uploading to get around the timeout problem and since the flag "-PackageOnly" is not yet available on the Publish-AzureServiceProject script, I usually run the script, wait for it to timeout and then upload the package it just created!