accessing image from public_html not possible - hosting

I am using Cyberhost.in to host a JSF application. The problem that I am facing is that whenever I am trying to access image files from public_html folder I am getting a 404 error. I have kept my war file in webapps folder. I am using c-panel, the thing is that I want to take backup of files for my website so I have kept them in public_html folder. Initially I was saving the files under webapps/[WAR FILE NAME] but when ever I was trying to overwrite webapps/[WAR FILE NAME] I was getting permission denied error.

You should upload image files on their location that you have mentioned in your code, otherwise you should change the location in website code of the same.
Also check permissions/ownership of files

Related

Storage symlink doesn't work with Laravel and Vue in Namecheap CPanel (LiteSpeed)

I am trying to access my image files stored inside storage/app/public/subfolder/ using symlink inside /public folder in my Laravel app. Everything works fine in my local setup and also in Jelastic Apache deployment, but it doesn't seem to work in CPanel with LiteSpeed. I am trying to access the files using the link /storage/subfolder/image.png but it is not accessible on CPanel deployment.
I tried creating and deleting storage symlink hundreds of times, but it didn't work. Below are few things I tried:
Deleting and creating symlink again and again using php artisan storage:link command.
Creating symlink using linux command ln -s ../storage/app/public storage inside public folder.
Running Artisan::call('storage:link') using a web route entry.
Redeploying and reconfiguring the app several times and creating storage symlink.
In all of these failed attempts I can verify that storage symlink is created every time inside public folder. I can navigate and view files from public/storage/ folder using CPanel terminal without any issues but can't access them in the deployed app.
I have exact same configuration in Jelastic Apache deployment and in my local deployment and there it is working without any issues.
UPDATE:
Additionally, I tried creating a storage directly manually inside public folder with the same structure and it worked. But symlink doesn't work.
UPDATE 2:
I found below error log while checking error logs from CPanel.
2022-11-06 05:07:07.342556 [ERROR] [1669834] [T0] [HTAccess] Failed to open [/home/user/my-project/public/storage/subfolder/.htaccess]: Permission denied
There is no .htaccess inside subfolder but it is there in my public folder.
What might be the issue?
After making linking you storage to your public path using storage:link you can access your folder :
'Storage_path('subfolder/image.png');'
After a long search, I finally found the cause.
Somehow the storage/app/public directory didn't have sufficient permissions. So, I gave permissions to that public folder recursively using chmod and everything works fine now.
The symlink was working fine but it was not working due to permission issues in the parent folder.
This is a bit weird as I have never manually altered permissions in any Laravel folders in any of my other deployments.

Temporary files directory "/var/www/html/activate/../temp/" is not writable on live server

I'm getting this error on live server while generating PDF file. It's working fine on my local system. I'm using Laravel and this mPdf package to generate PDF:
PDF Package
How can I give writable permissions to that 'Temp' folder, i can't find it in code and on server it's also not located anywhere in the path above. Thanks!
Create a directiry in public temp
in config/pdf.php
Change 'tempDir' => base_path('../temp/') to 'tempDir' => public_path('temp')
Give 777 permission to that folder.
I had the same problem with this package.
The best way is to create a folder called temp beside your root folder and give write permission to that.

How to upload properly in 000webhost using codeigniter for a project

I think I miss something in the index.php file or something. I'm trying to upload my project in a zip file named "application.zip" in 000webhost. but there is an error that keeps appearing when I try to access my website. here is the error: "Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php"

PhpStorm invalid descendant file name

This question couldn't solve my problem.
I got this error C:\xampp\tmp, I am using PhpStorm file transfer protocol and I get this error whenever I want to upload any file to my cpanel.
I could only upload files if I delete the folder c:\xampp\tmp on my cpanel and after some time the folder will appear again on my cpanel.
The c:\xamp\tmp is availabe on my local machine, I presume the file is been uploaded to the server and I don't want it to. the folder I am trying to upload is inside htdocs, its a Drupal 7 file.

Where to upload my PHP files on web hosting server?

I have a GoDaddy web hosting account with a cPanel access. I am trying to figure out where should i upload my php files.
I have created a new folder inside the public_html folder as fortnox_invoicing and have copied all the code (PHP/HTML/JS) files in that folder.
But when i try to browse the php files it doesn't work instead i get "ops, this page does not exist" message.
http://example.com/fortnox_invoicing/index.php
Following is how the public_html directory looks like for now:
You can upload your PHP files in public_html if you want to browse your website like:
http://example.com
You can also upload PHP files in subfolder if you wish to browse it like
http://example.com/subfolder
If you are receiving error 404 while browsing subfolder, locate .htaccess file and check if there is any rules that are restricting index.php to load and causing 404 page. If .htaccess file is hidden, you'll have to enable the show hidden file in while opening cPanel File Manager. Try renaming .htaccess file and load your website again. Also make sure that root folder contains index page and it is listed as default page in .htaccess file.
You see this page because your website doesn't have "index.php" or "index.html" file in public_html folder.
for example
-public_html
-index.php
**-subfolder**
-aboutus.php
-contact.php
-service.php
**-subfolder**
-thankyou.php
Most service providers use the above hierarchy.

Resources