ckfinder is not able to access the remote server files - laravel

I'm using CKFinder in my web app (based Laravel), in order to navigate and upload files to an nginx storage server.
I manage to do so when developing on localhost, so the connectivity between the client app and the storage server was using FTP.
After deploying the app into appEngine server, I'm getting the error: "It was not possible to complete the request due to file system permission restrictions".
Nothing have changed in the depolyed applocation, the code is exactly the same as in the localhost. except for the fact that the appEngine runs the app over https instead of http.
what might be the problem for this issus?
here are some of my configurations for ckfinder:
config.php:
$config['backends'][] = array(
'name' => 'my_conntection',
'adapter' => 'ftp',
'host' => 'hostnname',
'username' => 'username',
'password' => 'password',
'root' => '/upload',
'chmodFiles' => 0644,
'chmodFolders' => 0755,
'baseUrl' => 'https://hostname/upload',
'passive' => 'false',
);
What should I also do? Am I missing something?
Is there any alternatives for this annoying ckfinder?

Related

Laravel 8 - Find image url

I am using Laravel Framework 8.68.0.
I am having the following configuration in my filesystems.php:
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
'public_collectible_img' => [
'driver' => 'local',
'root' => storage_path('app/public/collectibles_img'),
'url' => env('APP_URL').'/collectible/image',
'visibility' => 'public',
],
The following link works:
http://localhost/myProject/public/storage/collectibles_img/0_test.jpg
The following link does not work:
http://localhost/myProject/public/collectible/image/0_test.jpg
All my images are in the following folder:
Any suggestion why my second link does not work?
I appreciate your replies!
The filesystems.php only affects Laravel's internal filesystem management (e.g. moving a file from within Laravel, saving an uploaded file, etc.), not the actual HTTP server which is what serves static files such as images. If you want to have a custom URL, you can either modify your web server's configuration (e.g. .htaccess), or create a Laravel route and controller to serve files from within Laravel. The latter approach will require that you map the requests to files yourself, and each request would have the overhead of loading PHP.
Alternatively, you could create a symlink from public/storage/collectibles_img to public/collectible/image (you would need to create the collectible folder first, then set up collectible/image as a symlink to public/storage/collectibles_img).

Laravel Vapor upload to DO Spaces

I want to use Laravel Vapor on my application. There's documentation on how to upload files to S3 using Vapor but none using other cloud providers. Is it possible to upload files to Digital Ocean's Spaces using vapor? If so does anyone have some sample code I could look at
Here's a sample configuration for some "attachments" filesystem on DigitalOcean (its considered an "S3" service as well). I used it in a raw Laravel project but I expect Vapor to offer a very similar configuration file.
So in essence it should work out of the box if you give it the correct credentials:
// config/filesystems.php
'attachments' => [
'driver' => env('ATTACHMENTS_DRIVER', 's3'),
'root' => 'attachments/',
'key' => env('DO_SPACES_KEY'),
'secret' => env('DO_SPACES_SECRET'),
'endpoint' => env('DO_SPACES_ENDPOINT'),
'region' => env('DO_SPACES_REGION'),
'bucket' => env('DO_SPACES_BUCKET'),
],
I added the DO_SPACES_xxx variables myself, you define them in your .env file, they should look similar to this:
DO_SPACES_KEY=5SOME4KEY3KRANDOMG
DO_SPACES_SECRET=12FABCI6D1MIz+Xep+321BC3MHcz+ABCO21
DO_SPACES_ENDPOINT=https://nyc3.digitaloceanspaces.com
# Region is empty in my configuration, not sure if you need it.
DO_SPACES_REGION=
DO_SPACES_BUCKET=yourbucketname

Laravel file upload storage link working but public link is not

This is in Nova but I think the issue is with how I've setup the filesystem. But just for the full context: I use the Nova Image field to upload an image.
In my config/filesystems:
'blog' => [
'driver' => 'local',
'root' => storage_path('app/public/blog'),
'url' => env('APP_URL').'/storage/blog',
'visibility' => 'public',
],
The file is uploaded correctly and a preview shows in Nova, both locally and on production. The preview uses the URL example.com/storage/blog/filename.jpg.
On the front-end I use asset('blog/'.$post->image) to display the image. The URL generated is example.com/blog/filename.jpg.
The weird thing is that this last URL works locally, but not on a production server (gives a 404). Does this have to do with folder/file permissions?
I have ran php artisan storage:link and on the server I can actually see the file both in app/public/blog and in public/storage/blog.

Laravel 5.1 send email (Connection could not be established with host smtp.gmail.com [connection time out #110]

I'm learning Laravel 5.1 mail for my project. So, I try to send simple email first from a new Laravel 5.1 application on my localhost.
this is my .env config file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=mygmail#gmail.com
MAIL_PASSWORD=mygmailpassword
MAIL_ENCRYPTION=tls
and this is my config/mail.php
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => 'sender#gmail.com', 'name' => 'Sender'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
this is my function to send the email
Mail::send('emails.email', ['user'=>'Sender'], function($m){
$m->to('receiver#yahoo.com','receiver')->subject('subject');
});
With this, when I run the application, it always return the error
Swift_TransportException in StreamBuffer.php line 265:
Connection could not be established with host smtp.gmail.com [Connection timed
out #110]
What I've tried:
Turn on 'less secure apps' on google account
2-step verification (generate an app password) and use it on (MAIL_PASSWORD on .env config)
But, none of this succeed. What am I doing wrong here?
PS: My OS is Linux Ubuntu 14.04
Did you try by changing these
MAIL_PORT=465
MAIL_ENCRYPTION=ssl
Write a ticket to your hosting support. I've had the same problem: my mails were successfully sent at localhost, but at the hosting there were troubles.
I've wrote to the technical support and the engineer said that the port 587 is blocked by default and they can unblock it if I wish. When the port was unblocked the error disappeared.
So easy)

Laravel OpenShift Deployment Issue in database migrations

I am trying to deploy a Laravel 4.2 application on RedHat OpenShift.
I have successfully transferred the code from GitHub but I am stuck at the database integration.
How do I run the migrations?
I have created a new mysql_openshift database connection with
OpenShift credentials and updated the same.
I have a migration file in the migrations folder.
But on running the php artisan migrate i get the following error:
http://i.stack.imgur.com/nQbam.png
Please help!
The Laravel 4.2 QuickStart was updated 2 days ago. The QuickStart now automatically runs php artisan migrate when you deploy changes to OpenShift. I definitely recommend switching over to using the QuickStart or updating to the latest version.
Anyways, the short answer to the problem you're seeing: your database is not configured properly in Laravel. See lines 60-70 of app/config/database.php in the Laravel 4.2 QuickStart for a reference on configuring the host/port connection info.
Your openshift db parameters are not set correctly.
Look at your config/database.php you will see how the setting in .env are used. Like before we try to get environmental variables from Openshift. The function env('DB_HOST', 'default') will take either DB_HOST from .env or use the default value in the second parameter. Since .env is excluded from version control, Laravel will take the Openshift-specific settings instead.
So put the following code in your config/app.php :
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', getenv('OPENSHIFT_MYSQL_DB_HOST')),
'database' => env('DB_DATABASE', getenv('OPENSHIFT_APP_NAME')),
'username' => env('DB_USERNAME', getenv('OPENSHIFT_MYSQL_DB_USERNAME')),
'password' => env('DB_PASSWORD', getenv('OPENSHIFT_MYSQL_DB_PASSWORD')),
'port' => env('DB_PORT', getenv('OPENSHIFT_MYSQL_DB_PORT')),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,],

Resources