Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure "undefined function Symfony\Component\Config\ctype_alpha()" #1654

Closed
chrisveness opened this issue Mar 23, 2017 · 13 comments
Closed
Assignees

Comments

@chrisveness
Copy link

I am attempting to build Ushahidi platform as per Install Ushahidi on Linux instructions.

After the following steps:

$ git clone https://github.com/ushahidi/platform.git
$ cd platform
$ [setup .env]
$ mv httpdocs/template.htaccess httpdocs/.htaccess
$ chmod 0777 application/logs application/cache application/media/uploads
$ bin/update

I get an error reported:

...
>>> Running migrations
PHP Warning:  Module 'dom' already loaded in Unknown on line 0
PHP Warning:  Module 'gd' already loaded in Unknown on line 0
PHP Warning:  Module 'imap' already loaded in Unknown on line 0
PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0
PHP Warning:  Module 'SimpleXML' already loaded in Unknown on line 0
Phinx by Rob Morgan - https://phinx.org. version 0.4.3

PHP Fatal error:  Uncaught Error: Call to undefined function Symfony\Component\Config\ctype_alpha() in /home/[...]/platform/vendor/symfony/config/Symfony/Component/Config/FileLocator.php:85
Stack trace:
#0 /home/[...]/platform/vendor/symfony/config/Symfony/Component/Config/FileLocator.php(42): Symfony\Component\Config\FileLocator->isAbsolutePath('application/phi...')
#1 /home/[...]/platform/vendor/robmorgan/phinx/src/Phinx/Console/Command/AbstractCommand.php(187): Symfony\Component\Config\FileLocator->locate('application/phi...', '/home/movable-t...', true)
#2 /home/[...]/platform/vendor/robmorgan/phinx/src/Phinx/Console/Command/AbstractCommand.php(212): Phinx\Console\Command\AbstractCommand->locateConfigFile(Object(Symfony\Component\Console\Input\ArgvInput))
#3 /home/[...]/platform/vendor/robmorgan/phinx/ in /home/[...]/platform/vendor/symfony/config/Symfony/Component/Config/FileLocator.php on line 85
@tuxpiper
Copy link
Member

Thank you for your report @chrisveness . We are looking into this.

@tuxpiper tuxpiper self-assigned this Mar 24, 2017
@tuxpiper
Copy link
Member

@chrisveness looking at your command sequence, did you run composer install?

@chrisveness
Copy link
Author

@tuxpiper I ran bin/update, which I believe ultimately runs composer install, yes.

@tuxpiper
Copy link
Member

@chrisveness I haven't been able to reproduce the problem in a fresh system

What distribution and version of PHP are you trying?

@chrisveness
Copy link
Author

chrisveness commented Mar 27, 2017

I've tried the install process again, and am no longer seeing that issue, so perhaps it's been fixed (either in ushahidi directly or in phinx).

However, I'm now seeing

[InvalidArgumentException]                                                                                                                   
There was a problem creating the schema table: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'end_time'

Searching previous issues, this appears to be related to #1177 – is Phinx something of a moving target?

I'm running Linux Mint 18 / Ubuntu 16.04 / Kernel 4.4.0, PHP v7.1.3, MySQL v5.7.17, Phinx v0.4.3.

@tuxpiper
Copy link
Member

Yes, #1177 is probably causing your trouble. It's actually MySQL that shook things up by changing the default way their engine worked with some aspects of SQL. If you adjust the sql_mode in MySQL, that should fix your problem.

Attention: our codebase is not compatible with PHP 7.x . You should install and use 5.6 .

@chrisveness
Copy link
Author

I'm afraid I'm struggling with this. From #1177, I take it the problem revolves around NO_ZERO_DATE?

I'm not sure how to switch off this option, and I'm also not sure that I will be able to for the entire database (e.g. in my.cnf). I see that NO_ZERO_DATE is default for MySQL 5.7, which is now some three years old.

If it's not possible to update Ushahidi to fix this issue, can you advise how I can disable the NO_ZERO_DATE option on a per-session basis in order to install Ushahidi? Thx.

@tuxpiper
Copy link
Member

In that case, could probably try to use a newer version of phinx. We haven't tested this fully, so YMMV.

Commands:

cat <<EOF | patch -p1
diff --git a/composer.json b/composer.json
index 7f91d34..dc68f57 100644
--- a/composer.json
+++ b/composer.json
@@ -25,7 +25,7 @@
         "kohana/image" : "3.3.*@dev",
         "kohana/minion" : "3.3.*@dev",
         "ohanzee/database": "~0.1.2",
-        "robmorgan/phinx": "~0.4.1",
+        "robmorgan/phinx": "~0.7.0",
         "ushahidi/shadowhand-email": "dev-master",
         "symm/gisconverter": "~1.0.5",
         "twilio/sdk": "3.12.*",
@@ -45,7 +45,6 @@
         "beheh/flaps": "dev-master",
         "doctrine/cache": "^1.5@dev",
         "satooshi/php-coveralls": "^2.0@dev",
-        "henrikbjorn/phpspec-code-coverage": "~2.0",
         "ramsey/uuid": "^3.4.1",
         "sentry/sentry": "~1.5"
     },
@@ -59,7 +58,7 @@
         "phpunit/phpunit": "~4.8",
         "phpunit/dbunit": "~1.4",
         "phpspec/phpspec": "~2.4",
-        "symfony/console": "2.6.*",
+        "symfony/console": "2.8.*@dev",
         "squizlabs/php_codesniffer": "1.5.*",
         "heroku/heroku-buildpack-php": "dev-master"
     },
EOF

then composer update and ./bin/update

@chrisveness
Copy link
Author

Thank you for your support, but having followed that procedure, I now have the following from bin/update:

>>> Skipping git
>>> Updating dependencies
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'curl' already loaded in Unknown on line 0
PHP Warning:  Module 'dom' already loaded in Unknown on line 0
PHP Warning:  Module 'gd' already loaded in Unknown on line 0
PHP Warning:  Module 'imap' already loaded in Unknown on line 0
PHP Warning:  Module 'json' already loaded in Unknown on line 0
PHP Warning:  Module 'mbstring' already loaded in Unknown on line 0
PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0
PHP Warning:  Module 'SimpleXML' already loaded in Unknown on line 0
PHP Warning:  Module 'tokenizer' already loaded in Unknown on line 0
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpunit/php-code-coverage 2.2.x-dev requires phpunit/php-token-stream ~1.3 -> no matching package found.
    - phpunit/php-code-coverage 2.2.x-dev requires phpunit/php-token-stream ~1.3 -> no matching package found.
    - Installation request for phpunit/php-code-coverage 2.2.x-dev -> satisfiable by phpunit/php-code-coverage[2.2.x-dev].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

I think I had better wait a bit until you next have a stable version released.

Thanks for the support.

@tuxpiper
Copy link
Member

Sorry about that @chrisveness .

We are now in an effort to performing some general updates to the dependencies. We hopefully should be in a better place soon.

@klimeto
Copy link

klimeto commented Apr 12, 2017

I used "monkey patching" from here. in /platform/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php as follows:
//->addColumn('end_time', 'timestamp')
->addColumn('end_time', 'timestamp', ['default' => 'CURRENT_TIMESTAMP'])

which solved the problem and migration has succeeded: All Done. Took 1.6829s

@klimeto
Copy link

klimeto commented Apr 12, 2017

The aforementioned monkey patch did not help, the app indeed installed the db, however later it could not use the database (error while inserting, e.g. new role, etc). I downgraded to Mysql 5.6 and all works fine.

@rjmackay
Copy link
Contributor

@klimeto @chrisveness can you try the current develop branch? We've update a lot of dependencies now, and improved mysql handling for more mysql 5.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants