Laravel with Informix database - laravel-5.3

I am using an Informix database and it seems like Laravel doesn't support it by default.
How can I use an Informix database with Laravel?
Your help is really appreciated!
I am using PHP 5.6.

You need to use a third party package. Laravel Informix Database Package
Just download it using composer, add the dependency, add the db provider and then publish your new config.
Step by step
Add to your composer.json file
"require": {
"poyii/laravel-ifx": "1.0.0"
}
Then run composer update
Once Composer has installed or updated your packages you need to register Informix DB. Open up config/app.php and find the providers key and add:
Poyii\Informix\InformixDBServiceProvider::class,
Finally you need to publish a configuration file by running the following Artisan command.
$ php artisan vendor:publish

Had the same need, but the above process won't work with newer version of laravel as the package is locked on version <= 5.2, so you will have to overwrite the repository to fix it.
I have documented the process for my self here: https://blog.rabin.io/sysadmin/laravel-lumen-informix

Related

DoctrineMigrationsBundle 3.0.1: metadata storage is not up to date

I recently got this error when running bin/console doctrine:migrations:migrate:
The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue.
However, running the sync-metadata-storage command yields the same error.
What can I do?
As mentioned in this GitHub issue one possible fix is to specify the MySQL server version in the server URL:
DATABASE_URL=mysql://root:#127.0.0.1:3306/test?serverVersion=mariadb-10.4.11
Then, you should be able to run the bin/console sync-metadata-storage command.
Read more about this configuration option in the doctrine documentation:
[…] you can pass the serverVersion option with a vendor specific version string that matches the database server version you are using […]
If you are running a MariaDB database, you should prefix the serverVersion with mariadb- (ex: mariadb-10.2.12).
I had to downgrade the doctrine/doctrine-migrations-bundle to version "^2.1"
Not sure if that applies here, but I had issues with doctrine lately aswell.
I did a composer update and ever since then, my project wouldn't run anymore. My issue was based on a new version of the following bundle:
https://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html
They restructred the doctrine_migrations.yaml file and I still had the old one. I tried to change the contents to the new 3.0 version but that lead exactly to your error.
Since the bundle comes with the package: symfony/orm-pack you first have to unpack the to be able to manually change the version inside your composer.json: composer unpack symfony/orm-pack
After unpacking you will see the following line inside your composer.json: "doctrine/doctrine-migrations-bundle": "*", which I changed to "doctrine/doctrine-migrations-bundle": "^2.1". Then i ran composer update again. You may specify only the migrations bundle if thats all you want to update.
Hello so i could fixe my issue just by removing (?versionname=5.7) to the database_url and it worked just fine

Symfony - Downgrade Minor Version

I'm working with a copy of Symfony (2.8.9) which works perfectly on my development server.
I've cloned the same repository that this server pulls from, down to my local, and updated composer / ran the Symfony installer. I started getting an error:
You have requested a synthetic service ("request").
I did a little research, and found that this is a bug in the next version of Symfony, 2.8.10, as reported here:
https://github.com/symfony/symfony/issues/19840
I will await the bug being fixed in 2.8.10, but in the meantime, I'd love to be able to downgrade from 2.8.10 to 2.8.9, so my local copy runs and matches the copy on my development server.
I've seen posts regarding changing the version numbers in composer.json, but all my numbers related to Symfony say "2.8", with the minor version number excluded. Additionally, my composer.json file matches on both my dev server and local.
Should I add the minor version number ".9" to the end of the composer.json dependencies, and install the dependencies with composer? Is it enough to add the minor version number to only Symfony-related dependencies, and have all other dependencies work correctly, or are there other version numbers that should be changed as well? Is my approach correct, or is there another way to do this entirely?
You can edit just one line in your composer.json:
"require": {
...
"symfony/symfony": "2.8.*, !=2.8.10",
...
This way, you tell Composer to avoid that specific version. All other dependencies will be retrieved automatically.
Important: you have to remove your composer.lock file first, as Composer will complain that you're locked to the very same version you're trying to avoid.
Disclaimer: backup and test first. I tested on a base Symfony install, not sure if other package will complain.

symfony plugin install namespace error

I created a new symfony 2 project using 2.7. When I try to install a plugin using command line "symfony plugin:install sfFormExtraPlugin", I got an error:
"[InvalidArgumentException]
There are no commands defined in the "plugin" namespace.".
When I type "symfony list", I got "
Available commands:
about Symfony Installer Help.
demo Creates a demo Symfony project.
help Displays help for a command
list Lists commands
new Creates a new Symfony project.
self-update Update the installer to the latest version.
selfupdate Update the installer to the latest version.
". no plugin or other command like "cache" etc. What should I do? Thanks!
sfFormExtraPlugin is a plugin for Symfony 1 and won’t work with Symfony 2.*
Also, the symfony command line tool in Symfony 2 is not meant for application commands anymore but for creating new projects/installing Symfony. The new command line tool for application commands is app/console (which you use like php app/console something:something.)
But even then, this command isn’t used for managing dependencies (like plugins) anymore. We use composer for that instead. That’s a powerful package manager for PHP that can install and update the packages you require and also make sure that they are compatible. And it is not limited to the Symfony world.

Symfony2 and HHVM Declaration of Doctrine\DBAL\Driver\PDOConnection::prepare() must be compatible

i am trying to set up a symfony2 project on a HHVM machine,
The HHVM is running on FastCGI as explained in the hhvm tutorial, thus running behind an apache2 server on Debian.
I have created everything but when i try to run my application i am getting the following error:
ContextErrorException: 16777217: Declaration of Doctrine\DBAL\Driver\PDOConnection::prepare() must be compatible with that of Doctrine\DBAL\Driver\Connection::prepare() in /LOCATION/shared/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php line 30
I am thinking this has something to do with PDO in HHVM but i tested it using the class_exists('PDO') and that says that PDO is enabled
This is an issue that was fixed via a pull request to the master branch of doctrine/dbal about 2 months ago. However, depending on the branch of Symfony 2 you are using, that doctrine/dbal fix may not be included.
https://github.com/doctrine/dbal/pull/373
If it is possible to use a version of Symfony 2 that includes this latest doctrine/dbal fix, I think you will see that issue go away.
I've had the same issue and upgrading doctrine/orm and doctrine/dbal to latest versions (listed below) fixed my problems.
doctrine/orm : 2.5.#dev
doctrine/dbal: 2.5.#dev
To safely upgrade, open your composer.json file, find and change the versions like so:
composer.json
"require": {
// ... other package requirements
"doctrine/orm": "~2.5.*#dev",
"doctrine/dbal: "~2.5.*#dev",
// .. more packages
Then run composer update doctrine/* which will remove the old versions of doctrine and update all doctrine packages.
The declaration of
Doctrine\DBAL\Driver\PDOConnection::query()
must be compatible with
PDO::query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs)
I had the same problem, but the solution was to just change the PHP version from version 8 to 7.3.
Login to your Cpanel with your credentials, search for MultiPHP Manager.
Select the domain or subdomain that you would like to change the PHP version of.
Select from the dropdown menu and chose the appropriate PHP version. (For me, 7.3 worked like a charm.)
Everything worked like it supposed to.

Upgrade my Symfony2 app to use composer

I want to upgrade my app that I've developed with Symfony2 for users who want to use it do so with composer.
I don't know how to create composer.json file based on deps file.
This's my deps file: https://github.com/biruwon/Vecinos2.0/blob/master/deps
For example, what about with the bundles without composer.json? Or libraries how TCPDF upload on sourceforge?
If you help me here or with a pull request I'll be very thankful to you.
PD: I do this first and then update Symfony2 to Symfony2.1
For TCPDF it's quite easy it is on packagist already.
For bundles or libs that are not on packagist, the best way is to first get it to work in your project using a custom package repository in your composer.json, and once that's done sending a pull request to the original author with a composer.json and asking them to submit it to Packagist is the way to go.
Download the composer in symfony2 root folder:
curl -s https://getcomposer.org/installer | php
and execute
php composer.phar self-update
php composer.phar update
use this if you can update to the last version.

Resources