php.ini file

Jul 18, 2009 at 7:39 PM

 

Does the php.ini file need to be renamed from php.ini.production to php.ini and modified in order to use phpAzure?  When using the sample code (shown below) to create a simple container on the live Azure service, I recieve the error message outlined below... I've uploaded the appropriate web.roleConfig file pointing FastCGI to %RoleRoot%\php\php-cgi.exe (and it does exist), but never-the-less, it errors out saying it's unable to load cURL.

Is it necessary to modify the php.ini under my PHP install directory and uncomment the line 'extension=php_curl.dll'?

Thanks..
Dustin

 

Source code:

/** Microsoft_Azure_Storage_Blob */
require_once 'Microsoft/Azure/Storage/Blob.php';
$storageClient = new Microsoft_Azure_Storage_Blob();
$result = $storageClient->createContainer('testcontainer');
echo 'Container name is: ' . $result->Name;

I get the following error:

Fatal error: Uncaught exception 'Microsoft_Http_Transport_Exception' with message 'cURL extension has to be loaded to use Microsoft_Http_Transport_Curl.' in E:\Microsoft\Http\Transport\Curl.php:66 Stack trace: #0 E:\Microsoft\Http\Transport.php(195): Microsoft_Http_Transport_Curl->__construct() #1 E:\Microsoft\Azure\Storage.php(275): Microsoft_Http_Transport::createChannel() #2 E:\Microsoft\Azure\Storage\Blob.php(141): Microsoft_Azure_Storage->performRequest('testcontainer', '', 'PUT', Array) #3 E:\createContainer.php(13): Microsoft_Azure_Storage_Blob->createContainer('testcontainer') #4 {main} thrown in E:\Microsoft\Http\Transport\Curl.php on line 66

 

Coordinator
Jul 20, 2009 at 7:42 AM

You'll indeed have to enable it and rename it to php.ini. Next, make sure Visual Studio packages teh php.ini file as "Content".

Nov 14, 2009 at 1:10 AM

I had the same issue. After reading a few articles on setting up PHP with different php.ini files for different websites, I came accross the answer.

Make sure your php.ini, all ext dlls, and every file in your php folder is set to Build Action = Content

Edit your php.ini so that extension_dir=./ext

In your web.config,

<add name="FastGGI Handler"
           verb="*"
           path="*.php"
           scriptProcessor="%RoleRoot%\PHP\php-cgi.exe|-c php.ini"
           modules="FastCgiModule"
           resourceType="Unspecified" />

note the | (pipe) arguments separator

In your web.roleconfig

<application fullPath="%RoleRoot%\php\php-cgi.exe" arguments="-c php.ini" />

note the "arguments" attibute