Enabling CURL for Codeception - php

I have an issue when executing tests with Codeception on Ubuntu 18.04 LTS. When I execute a test I get an error saying that CURL extension is not installed, but it is.
This is the error message I get:
Codeception requires CURL extension installed to make tests run
If you are not sure, how to install CURL, please refer to
StackOverflow
Notice: PHP for Apache/Nginx and CLI can have different php.ini
files.
Please make sure that your PHP you run from console has CURL enabled.
I enabled curl extension in php.ini file, but the result stays the same.
I'll be grateful for any help with this issue.

I guess, that you are using more then one PHP Version on the same system.
Try in command line php -m |grep curl. When the output is empty the current php has no curl extension installed. If the output is "curl", then it is and you can call codeception with php infront so you can be sure the php in the path is used.
php codecept run
And please be sure be up-to-date for codeception version.

Related

laravel 4 artisan make command - error Mcrypt PHP extension required

I'm trying to glean a signal from the noise in debugging this.
When I run ./artisan make:middleware MyTools, I get:
Mcrypt PHP extension required
Solutions seem to revolve around setting a proper value in /etc/php5/mods-available/mcrypt.ini and then doing a php5enmod mcrypt and Apache restart. Sounds good, and a phpinfo() call shows it's there and that I'm running PHP 5.5.9-1ubuntu4.20. All peachy.
However, I'm not running php 5 on the command line for artisan! Typing php -v tells me I'm running php 7.0.14-2.
When I go to /etc/php/7.0/mods-available, indeed I do not see mcrypt.ini - my question is how to "get" a proper mycrypt.ini file in there, have Mcrypt running for the COMMAND LINE, and not have to change anything else - for example I want to leave the webserver as it is at 5.5.9. How do I do this?
-- UPDATE --
See the discussion/comments below, I was able to get around this by DOWNGRADING my CLI to 5.5.9 vs. installing mcrypt into php7. This is not likely the best solution and I welcome a better one.

Php curl installed yet composer says its not

I am trying to get composer running solely for the purpose of updating my cc merchants files (since they are incompetent enough to make this the only way for downloading the api source)
I have an error from composer saying
Problem 1
- The requested PHP extension ext-curl * is missing from your system. Install or enable PHP's curl extension.
I have curl installed (responds in cmd) and and enabled the extension in the php.ini files i have found. What am I missing?
I have curl installed (responds in cmd) and and enabled the extension in the php.ini files i have found. What am I missing?
Hmm, it seems your are guessing around where the correct php.ini is in order to enable the PHP extension curl, right?
These steps might help you:
Please run php --ini on the CLI to find the php.ini to edit (Loaded Configuration File).
Then edit that php.ini and enable the PHP Extension curl.
Test, that curl is available: php --ri curl (the command prints the extension configuration).
Then run composer on the CLI again.
Curl and php5 curl extension is a different application.
If you are using ubuntu / debian based unix, you can install it with apt-get install php5-curl.
If after installing php5-curl it still doesn't works, it's possible the extension still not enabled. You can enabled it by using command php5enmod curl.

Error installing Laravel 4 with composer

When I try to install Laravel 4 via Composer, I get the following message in Terminal
Mcrypt PHP extension required. Script php artisan optimize handling
the post-install-cmd event returned with an error
The PHP version on my computer is 5.5.3 and when I run phpinfo it shows that mcrypt is enabled. When I run the which php command in Terminal it shows
/usr/bin/php
I therefore extended the $PATH with .bash_profile.
export PATH=/Applications/MAMP/bin/php/php5.5.3/bin:$PATH
Unfortunately, the which php command still shows /usr/bin/php after extending $PATH. And as a result the error is still there.
So I am out of ideas on how to solve this issue. Does anyone have an idea? Thanks!
There is difference between the MAMP PHP version and you "Terminal" PHP version. Therefore are you probably setting up the export path.
When you are changing the export path you have to restart your terminal before it will take effect on your computer.
I am not sure of this but when your error is appearing and older version of Laravel will be installed.
What do you get when you execute: php -v in your terminal?

CentOS - Mongo class not found in PHP

I need the MongoDB PHP driver on my CentOS 5.4 machine. My PHP version is 5.1.6. I downloaded the RPM and installed it. That created several files in /usr/bin directory. I copied
/usr/bin/mongo
to
/usr/lib/php/modules
which was what extension_dir showed on doing phpinfo();.
I also added
extension=mongo.so
in /etc/php.ini.
However on executing my PHP script, i still get
Mongo class not found.
What's going wrong here ?
Also, my phpinfo() shows PHP version 5.1.6 whereas running PHP from command line shows 5.3.3. Could anything be wrong with that ?
Thanks in advance.
You're saying your webserver and command line PHP report different versions. These are going to be installed in different locations, and their extensions are API incompatible with each other.
When you installed the php_mongo extension, it may have used the command line php to determine the directory to install the extension to.
Make sure you have the correct php_mongo for the php version of your webserver, and it is in the correct extensions directory. (get the directory from the php.ini returned by phpinfo())
I hope you realise PHP 5.1 is also many years out of date. Unless you have a specific reason to use a version that old, you should also look at upgrading to a more recent version.
Edit:
Just read your comment "I must also mention that /usr/bin/mongo is a binary executable file but its not having a .so extension. Im copying it as is to /usr/lib/php/modules"
No no no! :)
This is the mongo command line client. This is not the PHP extension!
You can run a find /* -name "mongo.so" to see where the installer put the file, this will probably also give you an indication of which version of PHP it was installed for.
It looks as though you are confusing the RPM-packages for the MongoDB server with the requirements to install the MongoDB PHP driver. The PHP driver provides access to the server from your PHP applications, and does not install any command line tools.
restart httpd !
yum service httpd restart

php related error in linux terminal while setting up symfony framework

i am trying to setup a new symfony framework project on ubuntu by following the documentation. But all the commands mentioned in the docs starting with 'php' give out the following error.
The program 'php' is currently not installed. You can install it by typing:
sudo apt-get install php5-cli
bash: php: command not found.
But php is installed and running on the system! How do i get past this error ?
Thanks in advance.
There are several different PHP packages; probably the one that is installed is the PHP module for Apache, not the command-line (CLI) version invoked as php.
Just run the command like it says, and you should be fine.
Is php on your path? (does it start if you just type in 'php' at the prompt or do you need to specify a path?)
If so, then its possible that the path is hardcoded to look elsewhere for your PHP executable. Try grepping the scripts to see where its looking.
If php is NOT on your path then try adding it, e.g. if php is in /usr/local/bin (and /usr/local/bin is not currently on your path)
export PATH=$PATH:/usr/local/bin
HTH
C.

Categories