I want to use the ftpd Adapter in Laravel to access a Synology NAS, which seems to need this specific adapter https://github.com/thephpleague/flysystem/issues/305, but I get the error
Driver [Ftpd] is not supported.
The file is there:
vendor/league/flysystem/src/Adapter/Ftpd.php
Do I have to register anything that I can use it?
I tried to use it in filesystems.php like this
'diskstation' => [
'driver' => 'Ftpd',
'host' => 'ftp.domain.com',
'username' => '****',
'password' => '****',
// Optional FTP Settings...
'port' => 21,
'root' => '',
'passive' => true,
'ssl' => false,
'timeout' => 10,
],
It looks like laravel does not support ftpd out of the box as you can see here:
https://github.com/laravel/framework/blob/5.4/src/Illuminate/Filesystem/FilesystemManager.php#L13
It imports a few of the Flysystem drivers, but not the ftpd one.
However you can create custom drivers like is shown here in the docs. The ftpd driver is already build for flysystem so you just need to import it in laravel via this method.
Related
I tried to install TYPO3 (8.7.7) on my Webserver (IIS) and I'd like to use my SQL Server instead of MySQL.
I found lots of instructions how to make this (on typo3.org and other websites) but none of these worked for me.
I found out, that I must install two extensions before I start the installation (ADOdb & DBAL). Probably there is my fault.
Can anybody explain step by step how to install these extensions before the TYPO3 installation?
I'm using the following configuration to successfully run TYPO3 on SQL Server on my local windows machine:
'DB' => [
'Connections' => [
'Default' => [
'charset' => 'utf-8',
'dbname' => 't3',
'driver' => 'sqlsrv',
'host' => 'localhost',
'password' => 'yourPassword',
'port' => 1433,
'user' => 'sa',
],
],
],
It's a bit complicated to set up with the installer as it is not yet "clickable". What you can do is call the install script and when it's asking you to configure the database connection you go to your file system and manually add the config section above (with your connection params of course) in the LocalConfiguration.php file.
Then reload the installer - which should now recognize the configured database connection and let you go to the last step where you can import / create the base tables and data.
Note: At the moment I know of two bigger areas where SQL Server is still a problem with TYPO3 8.7 - that's workspaces and database compare. The last one means that after you have existing data in your SQL Server tables won't let you alter them via the TYPO3 database compare tool - you have to change tables manually if you need to.
Find a gist of the table create statements on https://gist.github.com/psychomieze/9570ea1f578aee7a1fbb68c3240a21c8
With 8.7, Doctrine DBAL has been integrated into the core and ADOdb & DBAL sysexts have been removed as there is no need anymore.
Take a look at the documentation of Doctrine DBAL http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html and it should fit perfectly to the configuration of the DB in `LocalConfiguration.php``
'DB' => [
'Connections' => [
'Default' => [
'charset' => 'utf8',
'dbname' => 'typo3',
'driver' => 'mysqli',
'host' => 'mysql',
'password' => 'dev',
'port' => 3306,
'user' => 'root',
],
],
],
Now my Typo3 is working.
I solved my problem a little bit complicated.
I made a test environment and installed Typo3 with MySQL.
Then I copied the database with the "Microsoft SQL Server Migration Assistant 7.6 for MySQL"
(https://www.microsoft.com/en-us/download/details.aspx?id=54257) to my main environment.
After that I copied all the created folders (typo3conf, typo3temp etc.) to my main environment
and edited the databaseconnection in the LocalConfiguration.php file like Georg Ringer proposed.
When I am installing Typo3 and MSSQL next time I will do it like susi proposed.
Thanks for your help.
I'm trying to create a file upload where admin would upload file from admin application to another application for regular users (they are on different domains).
I got it working with FTP filesystem but I would like to test it on localhost, before I fully deploy it.
I made a config entry in filesystem.php:
'ftp' => [
'driver' => 'ftp',
'host' => env('FTP_HOST'),
'username' => env('FTP_USERNAME'),
'password' => env('FTP_PASSWORD'),
'root' => '',
'port' => 21,
'timeout' => 30,
'ssl' => true,
]
And on my test function in admin_app I do this:
Storage::disk('ftp')->put('/public_app/storage/test3.png', $file);
I have to separate laravel applications: admin_app and public_app. How could I test the same thing on localhost? Another config entry point or do I need to download FTP for localhost?
What about using something like remote server that contain your assets?
For example use S3 and upload all your files there and access it from your second app or any other app.
Check this Article
I’m newbie user of Yii and I need to connect my Yii2 application to a Google cloud database (postgres). I need to made the connection using the SSL certificates I already have. I have all the credentials (host, user, 3x ssl, etc).
The thing is I’m able to connect to this remote google database using both PgAdmin client and the Google SDK console (Google Shell), but I can’t connect my Yii2 application to this database. I read a lot of documentation and found nothing.
This is what I have in my common/config/main-local.php (Yii2 advanced configuration), I added the field 'attributes', just in case it works, but as I thought is not working:
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'pgsql:host=my-host;dbname=my-db-name',
'attributes' => [
PDO::PGSQL_ATTR_SSL_KEY => 'path/to/my/client-key.pem',
PDO::PGSQL_ATTR_SSL_CERT => 'path/to/my/client-cert.pem',
PDO::PGSQL_ATTR_SSL_CA => 'path/to/my/server-ca.pem',
],
'username' => 'myusername',
'password' => 'mypassword',
'charset' => 'utf8',
],
This is how I connect through Google Shell, this works:
psql "sslmode=verify-ca sslrootcert=path/to/my/server-ca.pem sslcert=path/to/my/client-cert.pem sslkey=path/to/my/client-key.pem hostaddr=google-instance-host user=david.tamarit dbname=google-db-name"`
Then, I put my password and I'm connected to my database in Google shell.
In PgAdmin, I pass my credentials and I connect to the database, this works too.
How can I connect to my google cloud database using Yii?
Thanks in advance!
Since the DB is not on your machine there is no need for you to have PostgreSQL installed and this is the reason (I think) that these constants are not recognised. Try this:
'attributes' => [
'sslmode' => 'verify-ca',
'sslkey' => 'path/to/my/client-key.pem',
'sslcert' => 'path/to/my/client-cert.pem',
'sslrootcert' => 'path/to/my/server-ca.pem',
],
I have been working on a project that requires I set it up in Heroku. The Database I have been using thus far locally is mySQL, but I am looking to use Postgre when the project is on Heroku.
I have done a large amount of searching but have yet to find an answer as to how I configure my Laravel project to use Postgres and how do I perform basic functions such as adding a new database to Postgres.
If there is an alternative way to just use mySQL as is that would be great.
Thanks for the help.
Heroku places (once you provision a Heroku Postgres instance) the database credentials in the DATABASE_URL environment variable, in the following format:
postgres://username:password#hostname:port/database
Now, you could manually fill out your DB_HOST, DB_USERNAME, etc. .env vars from this, but there's a better way: you can parse the URL in your config/database.php file.
Note: Newer versions of Laravel now support a DATABASE_URL .env value directly. No need to parse anymore.
'pgsql' => [
'driver' => 'pgsql',
'host' => parse_url(env('DATABASE_URL'), PHP_URL_HOST),
'port' => parse_url(env('DATABASE_URL'), PHP_URL_PORT),
'database' => ltrim(parse_url(env('DATABASE_URL'), PHP_URL_PATH), '/'),
'username' => parse_url(env('DATABASE_URL'), PHP_URL_USER),
'password' => parse_url(env('DATABASE_URL'), PHP_URL_PASS),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'sslmode' => 'prefer',
],
(Make sure you set DB_CONNECTION to pgsql so this connection is used!)
how do I perform basic functions such as adding a new database to Postgres
You don't. A Heroku Postgres instance comes with one database.
I am having a problem getting PPI framework to run on Server2go.
How do you use a port? for example 172.0.0.1:4001 in the datasource.config.php of PPI.
Assuming you're running PPI Framework v2.0, and that the database driver you're using on the PPI Datasource component is MySQL, then you're actually talking to a Doctrine DBAL connection, as such you can reference the Doctrine DBAL documentation.
As per this section here on their docs:
http://doctrine-dbal.readthedocs.org/en/latest/reference/configuration.html#pdo-mysql
You would specify the port number like this:
$connectionParams = array(
'dbname' => 'mydb',
'user' => 'user',
'password' => 'secret',
'host' => '172.0.0.1',
'driver' => 'pdo_mysql',
'port' => 4001
);
Please do let me know if you're not using PPI Framework 2.0 or not using MySQL, then the answer may be a bit different.