2

I'm trying to install cakephp using composer with this tutorial but after I run the command:

sudo composer create-project --prefer-dist cakephp/app my_app_name

I get the error:

Problem 1 - cakephp/cakephp-codesniffer 3.0.0 requires squizlabs/php_codesniffer ^3.0.0 -> satisfiable by squizlabs/php_codesniffer[3.0.0, 3.0.1, 3.0.2, 3.1.0, 3.1.1]. - cakephp/cakephp-codesniffer 3.0.1 requires squizlabs/php_codesniffer ^3.0.0 -> satisfiable by squizlabs/php_codesniffer[3.0.0, 3.0.1, 3.0.2, 3.1.0, 3.1.1]. - squizlabs/php_codesniffer 3.1.1 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system. - squizlabs/php_codesniffer 3.1.0 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system. - squizlabs/php_codesniffer 3.0.2 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system. - squizlabs/php_codesniffer 3.0.1 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system. - squizlabs/php_codesniffer 3.0.0 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system. - Installation request for cakephp/cakephp-codesniffer ^3.0 -> satisfiable by cakephp/cakephp-codesniffer[3.0.0, 3.0.1].

To enable extensions, verify that they are enabled in your .ini files: - /etc/php/7.0/cli/php.ini - /etc/php/7.0/cli/conf.d/10-opcache.ini - /etc/php/7.0/cli/conf.d/10-pdo.ini - /etc/php/7.0/cli/conf.d/20-calendar.ini - /etc/php/7.0/cli/conf.d/20-ctype.ini - /etc/php/7.0/cli/conf.d/20-curl.ini - /etc/php/7.0/cli/conf.d/20-exif.ini - /etc/php/7.0/cli/conf.d/20-fileinfo.ini - /etc/php/7.0/cli/conf.d/20-ftp.ini - /etc/php/7.0/cli/conf.d/20-gettext.ini - /etc/php/7.0/cli/conf.d/20-iconv.ini - /etc/php/7.0/cli/conf.d/20-intl.ini - /etc/php/7.0/cli/conf.d/20-json.ini - /etc/php/7.0/cli/conf.d/20-mbstring.ini - /etc/php/7.0/cli/conf.d/20-phar.ini - /etc/php/7.0/cli/conf.d/20-posix.ini - /etc/php/7.0/cli/conf.d/20-readline.ini - /etc/php/7.0/cli/conf.d/20-shmop.ini - /etc/php/7.0/cli/conf.d/20-sockets.ini - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini - /etc/php/7.0/cli/conf.d/20-sysvsem.ini - /etc/php/7.0/cli/conf.d/20-sysvshm.ini - /etc/php/7.0/cli/conf.d/20-tokenizer.ini You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

I installed codeSniffer using both curl and composer. still I can't get rid of the error. any ideas what I am doing wrong?

Bahman Rouhani
  • 1,139
  • 2
  • 14
  • 33
  • 1
    you don't have one of those extension installed on your web server – madalinivascu Nov 06 '17 at 08:17
  • 1
    @madalinivascu but I followed the tutorial steps.So shouldn't they be installed? and how can I tell which one? – Bahman Rouhani Nov 06 '17 at 08:23
  • Read the error message closely, it tells you wich extensions are missing: "_squizlabs/php_codesniffer 3.1.1 requires **ext-simplexml** * -> the requested PHP extension **simplexml** is missing from your system_" – ndm Nov 06 '17 at 12:34

4 Answers4

9

I had a similar error at one point. It was fixed by installing php-xml. Make sure you install what waris said also.

sudo apt-get install php-xml
stealth
  • 319
  • 6
  • 5
2

I had a similar error at one point. It was fixed by installing php-xml. Make sure you install what waris said also. first php version

php -v

and

sudo apt-get install <your php version>-xml
1

You need to install some extension i-e:

sudo pear install PHP_CodeSniffer

And also enable the php extensions for composer i-e curl,intl

sudo apt-get update

sudo apt-get install curl php-cli php-mbstring git unzip

extra options:

to install composer globally :

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
waris
  • 204
  • 1
  • 10
  • if still exist any extension to enable mention here i help you – waris Nov 06 '17 at 08:33
  • PEAR is dead, and installing PHPCS that way instead of via composer won't fix the underlying problem, which, as the error message suggests, is that the the SimpleXML extension is missing. – ndm Nov 06 '17 at 12:40
  • try this for xml `sudo apt-get install php-xml` – waris Nov 06 '17 at 12:49
0

It looks like codeSniffer requires squizlabs ^3.0.0. And it also looks like you need to enable extensions in your .ini files.