cURL not working in laravel - laravel

I am doing a custom SMS gateway integration with Laravel. I used curl for that. Curl is already enabled in my localhost(XAMPP, ubuntu) and I can use curl in simple PHP. But when I try to call curl_init() in laravel leads to an error FatalErrorException in Builder.php line 311:
Call to undefined function Ixudra\Curl\curl_init(). When I use var_dump(function_exists('curl_version')); , I got bool(false). How can I use curl in Larvel

Check php.ini for the extension=php_curl.dll and make sure it is enabled. If not,enable it and restart xampp. Check the first answer here for a sample request.

Related

The Encrypt library requires the Mcrypt extension error

I am getting this error message in CI and I am using XAMPP:
An Error Was Encountered
The Encrypt library requires the Mcrypt extension.
I already look for other similar post but still have not found the right answer.
I try this adding this script in my php.ini XAMPP:
extension=php_mcrypt.dll
line 887.
and restart my xampp. but the same error still appears.
Thanks.
I was getting this error because i had switched from XAMPP(php5) to XAMPP(php7),
for this I replaced my old CI->system->libraries->encrypt.php with new file here:encrypt.php, and it worked.
In this new file we check if mcrypt_encrypt is supported or not in __construct function with code below
$this->_mcrypt_exists = ( ! function_exists('mcrypt_encrypt')) ? FALSE : TRUE;
and based on that we use different function between mcrypt_encode and _xor_encode like that.
Just to know, if you see this old file in __construct function you will see actual error checking
if (($this->_mcrypt_exists = function_exists('mcrypt_encrypt')) === FALSE)
{
show_error('The Encrypt library requires the Mcrypt extension.');
}
It worked for me.
It finally works after I move the server from PHP 7 to PHP 5 xampp server.

Laravel 5.4 (1/1) FatalErrorException - Default value for parameters with a class type hint can only be NULL in CssSelectot\rConverter.php line 34

Can anyone please help me with the above error. I am running Laravel 5.4 and php 5.6. I can register a user and be able to login but whenever I attempt to send an email(password recovery email and email verification for example) I get the above error.
Try this command:
composer --prefer-dist --verbose -vvv update

using laravel 5.5 and get error to create my controller?

I am using laravel 5.5 and I get an error when I create my controller.
$ php artisan make:controller MyDatatablesController
I want to create new controller but I get this error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW)
Your command is perfect their is some error in your project check your recent changes in your project
You're having an error on your own code. Probably it's a code not always executed. Try executing the command in verbose mode to have more information about the error
php artisan make:controller MyDatatablesController -vvv

Magento Command line script Class 'SoapClient' not found

I am trying to run a script from commandline to call a method in a Model, which involves the class SoapClient But come up with the error message
PHP Fatal error: Class 'SoapClient' not found in ....
Line which has the error is
$client = new SoapClient($this->_soapUrl);
I run the same process through web using a test route and it works.
Checked PHPINFO and it says
Soap Client enabled
Soap Server enabled
How can I include the SoapClient Class to the script or what can be the solution?
Your command line PHP uses different php.ini. Find out which php.ini file is used in PHP CLI and make sure the Soap extension is loaded there as well.

Errors while running Artisan in Laravel 4

Whenever i try to run any php artisan commands from the command line, I get the following error(s):
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","me
ssage":"Call to a member function connection() on a non-object","file":"C:\\wamp
\\www\\cms\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Mod
el.php","line":2649}}{"error":{"type":"Symfony\\Component\\Debug\\Exception\\Fat
alErrorException","message":"Call to a member function connection() on a non-obj
ect","file":"C:\\wamp\\www\\cms\\vendor\\laravel\\framework\\src\\Illuminate\\Da
tabase\\Eloquent\\Model.php","line":2649}}
I have specified the Laravel version as 4.1.* in my composer.json but since i can't run artisan, i don't know the exact version.
This problem didn't use to happen before. And the website seems to be running fine, despite of the errors occuring in php artisan. Composer commands also work fine, as far as i can tell.
Any ideas why it is happening now?
This error seems to have happened, because for the mail configuration in app/config/mail.php, I made it to retrieve the values from the database instead of specifying the configuration options directly in that file.
So, I had to check if the function for getting the value is called from the web or from the command line. If the function is called from the command line, I simply returned an empty string.
if(php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
return '';
}

Resources