Tuesday, July 14, 2015

PHP cURL Guzzle mbstring apache extension - crap of the day

My day's woes were something like so.. Working on the OAuth driver was throwing some stuff I hadn't seen before. It had a short fix.

Short fix: PHPIniDir directive in Apache, configured alongside PHP extension, should point to the php.ini file, not the php.ini directory!

Platform: Windows 7 / Apache 2.4 / PHP 5.6.11 Thread-safe / Laravel 5.1 / MySQL 5.6

I had set my path variables right, and phpinfo() was showing that it could pick php.ini from its directory just fine. Apache sometimes has a separate php.ini that comes with XAMPP-type installations, but that wasn't the case. I went through all documentation of guzzle and checking out the Middleware and its Promises and dd-ing in my libraries... which was basically pointless.

Finally it was established that cURL wasn't loading because it wasn't being picked up by PHP. I started getting a mbstring error now; while the extension was enabled. Disabling other extensions didn't affect the output. That's when I tried checking all ways php.ini could be popped in, and wallah, editing the PHPIniDir in httpd.conf, worked.

[2015-07-14 15:33:10] local.INFO: Authenticating user with provider: twitter
[2015-07-14 15:33:10] local.INFO: redirecting to twitter
[2015-07-14 15:33:10] local.ERROR: exception 'Guzzle\Common\Exception\RuntimeException' with message 'The PHP cURL extension must be installed to use Guzzle.' in G:\passionstreet\framework\laravel\vendor\guzzle\guzzle\src\Guzzle\Http\Client.php:72
Stack trace:
#0 G:\passionstreet\framework\laravel\vendor\league\oauth1-client\src\Client\Server\Server.php(307): Guzzle\Http\Client->__construct()


And before that a Guzzle Client 400 Error

[2015-07-14 15:13:25] local.INFO: Authenticating user with provider: facebook
[2015-07-14 15:13:25] local.INFO: retrieving social login user, with provider facebook
[2015-07-14 15:13:26] local.ERROR: exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: 400' in G:\passionstreet\framework\laravel\vendor\guzzlehttp\guzzle\src\Middleware.php:69
Stack trace:
#0 G:\passionstreet\framework\laravel\vendor\guzzlehttp\promises\src\Promise.php(198): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#1 G:\passionstreet\framework\laravel\vendor\guzzlehttp\promises\src\Promise.php(152): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)

And before that a Guzzle 403

[2015-07-14 14:41:54] local.INFO: retrieving social login user, with provider google
[2015-07-14 14:41:56] local.ERROR: exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: 403' in G:\passionstreet\framework\laravel\vendor\guzzlehttp\guzzle\src\Middleware.php:69
Stack trace:
#0 G:\passionstreet\framework\laravel\vendor\guzzlehttp\promises\src\Promise.php(199): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#1 G:\passionstreet\framework\laravel\vendor\guzzlehttp\promises\src\Promise.php(152): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)

And before that doing something weird redirecting with a provider 'Rahul'

[2015-07-14 14:41:39] local.INFO: Authenticating user with provider: rahul
[2015-07-14 14:41:39] local.INFO: redirecting to rahul
[2015-07-14 14:41:39] local.ERROR: exception 'InvalidArgumentException' with message 'Driver [rahul] not supported.' in G:\passionstreet\framework\laravel\vendor\laravel\framework\src\Illuminate\Support\Manager.php:90
Stack trace:
#0 G:\passionstreet\framework\laravel\vendor\laravel\framework\src\Illuminate\Support\Manager.php(63): Illuminate\Support\Manager->createDriver('rahul')

Then back to the cURL

Then I got back to the first error to start my day, that in one of the views
[2015-07-14 13:10:06] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Method Illuminate\View\View::__toString() must not throw an exception' in G:\passionstreet\framework\laravel\storage\framework\views\f404135fc8f0d4d388888d2a371ebe1d:0
Stack trace:
#0 {main}
[2015-07-14 13:23:54] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Method Illuminate\View\View::__toString() must not throw an exception' in