Symfony2 Shell.php error on production server - symfony

I get the following error in app_dev.php on my production server:
ErrorException: Notice: Undefined variable: output in /www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Finder/Shell/Shell.php line 59
in /www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Finder/Shell/Shell.php
line 59
at ErrorHandler->handle('8', 'Undefined variable: output', '/www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Finder/Shell/Shell.php',
'59', array('command' => 'find')) in
/www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Finder/Shell/Shell.php
line 59
at Shell->testCommand('find') in /www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php
line 123
at AbstractFindAdapter->isSupported() in /www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Finder/Adapter/GnuFindAdapter.php
line 30
at GnuFindAdapter->isSupported() in /www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Finder/Finder.php
line 700
at Finder->searchInDirectory('/www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations')
in
/www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Finder/Finder.php
line 628
at Finder->getIterator() in /www/acme/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
line 555
at FrameworkExtension->registerTranslatorConfiguration(array('fallback'
=> 'pl', 'enabled' => true), object(ContainerBuilder)) in /www/acme/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
line 106
at FrameworkExtension->load(array(array('translator' => array('fallback' => 'pl'), 'secret' =>
'eea6ad638afadb62cd7bc360e98f7d3b', 'router' => array('resource' =>
'/www/acme/www/app/config/routing.yml', 'strict_requirements' =>
true), 'form' => true, 'csrf_protection' => true, 'validation' =>
array('enable_annotations' => true), 'templating' => array('engines'
=> array('twig')), 'trust_proxy_headers' => false, 'default_locale' => 'pl', 'session' => null), array('router' => array('resource' =>
'/www/acme/www/app/config/routing_dev.yml'), 'profiler' =>
array('only_exceptions' => false))), object(ContainerBuilder)) in
/www/acme/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php
line 42
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in
/www/acme/www/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php
line 39
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in
/www/acme/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php
line 119
at Compiler->compile(object(ContainerBuilder)) in /www/acme/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
line 494
at ContainerBuilder->compile() in /www/acme/www/app/bootstrap.php.cache line 950
at Kernel->buildContainer() in /www/acme/www/app/bootstrap.php.cache line 859
at Kernel->initializeContainer() in /www/acme/www/app/bootstrap.php.cache line 571
at Kernel->boot() in /www/acme/www/app/bootstrap.php.cache line 614
at Kernel->handle(object(Request)) in /www/acme/www/web/app_dev.php line 29
Everything works fine on my localhost so it can be something wrong with the server configuration.

Hosting provider has turned PHP exec function off because of the security reasons.
That's why above error occurred.
Does anyone know if its possible to bypass exec function in Symfony2 - I mean if it's possible to run symfony2 on the server with exec function turned off?

I've got the same problem with my hosting, with php safe_mode off. Actually there is a todo, but I dont know when they will fix it.
// todo: find a better way (command could not be available)
exec('command -v '.$command, $output, $code);
as seen in Symfony\Component\Finder\Shell\Shell;

Related

Symfony cloud MPDF temp files can't be stored in /tmp

Our project is going to be on Linux, and we want to have the temp files be stored in /tmp/mpdf. I have the following MPDF constructor:
$mpdf = new Mpdf(['mode' => 'en',
'default_font_size' => 8,
'margin_left' => 9.5,
'margin_right' => 0,
'margin_bottom' => 37,
'margin_header' => 0,
'margin_footer' => 2,
'fontDir' => array_merge((new ConfigVariables())->getDefaults()['fontDir'], [realpath(getenv('DOCUMENT_ROOT')) . '/../assets/fonts']),
'fontdata' => (new FontVariables())->getDefaults()['fontdata'] + [
'arialuni' => [
'R' => 'arialuni.ttf',
'B' => 'arialuni.ttf'
]
],
'tempDir' => sys_get_temp_dir()
]);
However, I end up getting the following error:
"[prod] Feb 26 10:40:30 |CRITICA| REQUES Uncaught PHP Exception Mpdf\MpdfException: "Temporary files directory "/app/vendor/mpdf/mpdf/src/Config/../../tmp/mpdf" is not writable" at /app/vendor/mpdf/mpdf/src/Cache.php line 21"
From what I understand, it still tries to use the following folder:
/app/vendor/mpdf/mpdf/tmp/mpdf
It should however use the /tmp folder which was recommended by the symfony cloud support (the /tmp folder of Linux)
So I had the same issue recently and it is caused by the Mpdf library not having enough permission to write to the vendors folder, (which frankly it shouldn't have).
The solution for me was to update the tmp_dir in ConfigVariables.php to use PHP's temp dir instead of the one it tries to use.
Made a fork => https://packagist.org/packages/tevli/mpdf
Github => https://github.com/tevli/mpdf

Cannot update to Drupal 8.7.1 because of taxonomy_post_update_make_taxonomy_term_revisionable

After running composer update drupal/core webflo/drupal-core-require-dev --with-dependencies to update to v8.7.1, and then running drush updb, the update fails here:
[notice] Update started: taxonomy_post_update_make_taxonomy_term_revisionable [4.77 sec, 33.46 MB]
[error] Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null: INSERT INTO {tmp_b3edd9taxonomy_term_field_data} (tid, revision_id, vid, langcode, name, description__value, description__format, weight, changed, default_langcode, status, revision_translation_affected) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11);
Array
(
[:db_insert_placeholder_0] => 1
[:db_insert_placeholder_1] => 1
[:db_insert_placeholder_2] => tags
[:db_insert_placeholder_3] => zxx
[:db_insert_placeholder_4] =>
[:db_insert_placeholder_5] =>
[:db_insert_placeholder_6] =>
[:db_insert_placeholder_7] =>
[:db_insert_placeholder_8] =>
[:db_insert_placeholder_9] =>
[:db_insert_placeholder_10] =>
[:db_insert_placeholder_11] => 1
)
in Drupal\Core\Database\Connection->handleQueryException() (line 689 of /mnt/www/html/optivode42/docroot/core/lib/Drupal/Core/Database/Connection.php). [7.12 sec, 45.21 MB]
[error] The entity update process failed while processing the entity type taxonomy_term, ID: 1. [8.17 sec, 45.24 MB]
[error] Update failed: taxonomy_post_update_make_taxonomy_term_revisionable [8.17 sec, 38.9 MB]
Other solutions suggested bad data in the taxonomy_term_field_data field, but that doesn't seem to be the problem here.
I checked taxonomy_term_field_data and there are no records where name is NULL, nor do I even have any records with langcode zxx, so I'm a bit at a loss now. Seems like there's nothing I can delete to fix this like in the other answers.
*Edit: I do have langcode zxx records in the taxonomy_term_data, so I deleted these records, and I get the same error, but with:
Array
(
[:db_insert_placeholder_0] => 2
[:db_insert_placeholder_1] => 2
[:db_insert_placeholder_2] => tags
[:db_insert_placeholder_3] => en
[:db_insert_placeholder_4] =>
[:db_insert_placeholder_5] =>
[:db_insert_placeholder_6] =>
[:db_insert_placeholder_7] =>
[:db_insert_placeholder_8] =>
[:db_insert_placeholder_9] =>
[:db_insert_placeholder_10] =>
[:db_insert_placeholder_11] => 1
)
I found that this is linked to a bug in the replicate-ui module which actually creates taxonomies without creating a real parent record in the taxonomy_index table.
Thus, I have opened up a bug report with the developer to fix this.
In the meantime, I actually upgraded to Drupal v8.6.16 since that has the security update that I needed, and I don't need to go all the way to v8.7 just yet.

Bugzilla throws error when migrating from an old version

I am trying to migrate from an old bugzilla to a newer one. I installed a newer one on a new server. I run ./checksetup.pl and this is the error:
A valid TYPE was not specified for this column (got $VAR1 = {'PRIMARYKEY' => 1,'ENGINE' => 'MEDIUMSERIAL','NOTNULL' => 1};
) at Bugzilla/DB/Schema.pm line 1975.
Bugzilla::DB::Schema::get_type_ddl('Bugzilla::DB::Schema::Mysql=HASH(0x8 120cd8)', 'HASH(0x8261308)') called at Bugzilla/DB/Schema/Mysql.pm line 380
Bugzilla::DB::Schema::Mysql::get_rename_column_ddl('Bugzilla::DB::Schema ::Mysql=HASH(0x8120cd8)', 'fielddefs', 'fieldid', 'id') called at Bugzilla/DB.pm line 1026
Bugzilla::DB::bz_rename_column('Bugzilla::DB::Mysql=HASH(0x7fed8c0)', 'f ielddefs', 'fieldid', 'id') called at Bugzilla/Install/DB.pm line 69
Bugzilla::Install::DB::update_fielddefs_definition() called at ./checkse tup.pl line 164

NotFoundHttpException in RouteCollection.php line 161 resource controller

I am using following code in routes/web.php
Route::resource('affiliate/account', 'Affiliate\AccountController',
[
'pSignup' => 'affiliate.signup',
'gSettings' => 'affiliate.settings'
]
);
Controller is in app/Http/Controllers/Affiliate/AccountController.php
I am getting following error.
NotFoundHttpException in RouteCollection.php line 161
Any suggestions, what is causing this error?

Environment for a Qt Program

I have a Qt executable file.
When this program runs on a Ubuntu 11.04 virtual machine, the GUI is ugly though you can still tell it is the GUI that you want. When it runs on Ubuntu 12.04 of my laptop, however, everything goes well. Thus I guess there might be something wrong with the environment of the virtual machine.
To find out whether the problem lies in the libraries, I ran the command
ldd filename
I got library dependencies as following:
% Below is the output on the virtual machine
linux-gate.so.1 => (0x00cc8000)
libQtGui.so.4 => /opt/qt-4.7.1x86/lib/libQtGui.so.4 (0x00cc9000)
libQtCore.so.4 => /opt/qt-4.7.1x86/lib/libQtCore.so.4 (0x00110000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x003b6000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0x003cf000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x004ba000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0x004e0000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x004fc000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0x00686000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0x00695000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x0065d000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0x007b0000)
/lib/ld-linux.so.2 (0x00668000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0x00a96000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0x009ed000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0x008a8000)
% Below is the output on Ubuntu 12.04 of my laptop
linux-gate.so.1 => (0xb776f000)
libQtGui.so.4 => /usr/lib/i386-linux-gnu/libQtGui.so.4 (0xb6c8a000)
libQtCore.so.4 => /usr/lib/i386-linux-gnu/libQtCore.so.4 (0xb69ad000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb6991000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb68ac000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6880000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6862000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb66bd000)
libfontconfig.so.1 => /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xb6688000)
libaudio.so.2 => /usr/lib/i386-linux-gnu/libaudio.so.2 (0xb666f000)
libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb6576000)
libpng12.so.0 => /lib/i386-linux-gnu/libpng12.so.0 (0xb654c000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb6536000)
libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb649b000)
libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb644c000)
libSM.so.6 => /usr/lib/i386-linux-gnu/libSM.so.6 (0xb6443000)
libICE.so.6 => /usr/lib/i386-linux-gnu/libICE.so.6 (0xb6429000)
libXi.so.6 => /usr/lib/i386-linux-gnu/libXi.so.6 (0xb6419000)
libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xb640e000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb63fc000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb62c8000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb62c3000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb62ba000)
/lib/ld-linux.so.2 (0xb7770000)
libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xb628f000)
libXt.so.6 => /usr/lib/i386-linux-gnu/libXt.so.6 (0xb6233000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb622f000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb61f3000)
libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb61ec000)
libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xb61e5000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb61c4000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb61bd000)
Then I am wondering how can they be different? Can I find out what is wrong by tools such as strace?
I can see that Qt is installed in /opt on your 11.04. I guess that means you've built it yourself? Two solutions here:
Install Qt from Ubuntu's repository instead. It comes with the needed Gtk style. (Note that 11.04 also has Qt available; it's just that 12.04 installs it by default while 11.04 doesn't.)
When you build Qt, make sure to enable the Gtk style by passing the "-gtkstyle" option to the configure script. You will probably need to have all needed development packages for Gtk installed.
The display of text in the program is too ugly to be simply a problem of style. But the problem indeed lies in the process of building Qt. When I ran ./configure, I output the configure information into a log file and found things like
88 Xinerama support ....... no
89 Xcursor support ........ no
90 Xfixes support ......... no
91 Xrandr support ......... no
92 Xrender support ........ no
93 Xi support ............. no
Moreover, I found the Qt for X11 requirements here. Therefore I concluded that the problem lies in a lack of such libraries. And fortunately, everything works fine after installing them.

Resources