I am trying to deploy my WordPress site from local to staging. I'm able to deploy the files up to my hosting site but now I'm getting an error in Chrome when I'm trying to access my site http://staging.responsivhub.com/
After uploading my site to my webserver "siteground" in public_html/staging and have changed my subdomains root location to public_html/staging/current/web. After that I'm getting this error
Warning:
require_once(/home/user/public_html/staging/releases/1/vendor/autoload.php):
failed to open stream: No such file or directory in
/home/user/public_html/staging/releases/1/web/wp-config.php on line 7
Fatal error: require_once(): Failed opening required
'/home/user/public_html/staging/releases/1/vendor/autoload.php'
(include_path='.:/usr/local/php71/pear') in
/home/user/public_html/staging/releases/1/web/wp-config.php on line 7
(I have replaced my username to user)
I can't figure out what I'm missing.
You need to create the web/wp-config.php files inside the shared folder with the database credentials and all the WordPress configuration.
Go to (with the webserver/deploy user):
mkdir /home/user/public_html/staging/shared/web
vim /home/user/public_html/staging/shared/web/wp-config.php
And then include the configuration inside that file. After that try to re-run the deploy. I'm not sure if the wp-config.php file is on the root folder so you can try to remove web/ folder when running the commands.
Related
I am deploying Laravel 9 project to shared hosting (without the ability to ssh into the server so I can't npm run build in the server) and I am getting this error:
Vite manifest not found at: laravel_project/public/build/manifest.json
I am using FileZilla to upload the project to the CPanel, I uploaded the public folder into public_html and configured the index.php file.
Before uploading the project i run npm run build locally on my localhost and everything works ok there.
Does anyone have a solution for this ?
I tried changing the APP_ENV=production but it didn't work.
so I found a solution for that which is:
put all my local laravel files and folders including the public folder (of course after running composer install and npm run build locally) inside the public_html directory in the server
now inside the server in public_html directory move the two files .htaccess and index.php of the public folder one level up in way so that the index.php file and the .htaccess file are directly inside the public_html directory (this way you don't have to include /public in your url but instead access the application directly when you visit your website)
configure the content of index.php you just moved from public up to public_html in a way that its links point correctly to the content of the app inside public_html
for example:
__DIR__.'/../storage/framework/maintenance.php'
becomes
__DIR__.'/storage/framework/maintenance.php'
so that the /.. is removed
and the other links too like:
__DIR__.'/../vendor/autoload.php'
becomes
__DIR__.'/vendor/autoload.php'
and
__DIR__.'/../bootstrap/app.php'
becomes
__DIR__.'/bootstrap/app.php'
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.
I have a website template that I uploaded to my ftp server using FileZilla. However when I visit the domain I get the error:
Directory Listing Denied
This Virtual Directory does not allow contents to be listed.
in the console it displays a 403 forbidden error. After researching I recognize that the default web page inside the root directory is not set. All my attempts to set the default page have failed. Here is what I tried:
1) Logged into ftp server with FileZilla. Clicked File > Site Manager > Advanced and set the root directory. The root directory contains a file that says index.html
2) Created a .htaccess file in the root that contains the text "DirectoryIndex index.html"
Solutions involving IIS are welcomed as well.
Any advice on how I can get this fixed?
Unfortunately I did not have permissions to access the actual server files so I contacted the hosting company.
They resolved my issue I believe using the approach #alvits recommended, however they have not returned my request to confirm how they solved it.
Thanks for the support
I deployed my Laravel 5 app (empty initial app) to Heroku using Github repository and it keeps producing exception
production.ERROR: ErrorException: file_put_contents(/8a232580639f5a7a06b1d497d0825c281c17c91d.php): failed to open stream: Read-only file system in /app/bootstrap/cache/compiled.php:7198
Why would it even try to create a file in the root / directory?
The interesting thing is if I create a new Laravel application and deploy it using Heroku's Git (vs Github repo) it works without problems.
Make sure storage/ path is not ignored. Instead of ignoring the whole storage/ path, replace it with the following in your .gitignore. This can be improved on what are the files and directories that will be created under storage, I haven't much done laravel/lumen in a while so I'm not so sure. But this are the basic ones.
storage/app/*.php
storage/framework/*/*.php
I just got a script from a friend and was written with the laravel framework. After uploading the script to my file manager, i am having this error
Warning: require(C:\xampp\htdocs\bin\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\bin\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\bin\bootstrap/../vendor/autoload.php' (include_path='\xampp\php\PEAR') in C:\xampp\htdocs\bin\bootstrap\autoload.php on line 17
From the error, i saw that the vendor folder was missing in my files and my friend also didnt have it.
I saw many articles talking about installing composer but i'm not having the laravel framework and the project is already on a web server.
Things i have tried.
I have copied other "vendor folder" from other laravel script i have, doesnt work.
I also tried installing composer on my pc and copied the vendor folder generated. still doesnt work
Please i will be very happy if anybody can help with this.
Thanks in advance.
IF you try upload your project to web hosting. follow this step.
compress whole project on your xampp/wampp/etc with zip extension
upload to your web hosting.
extract the file
create "Laravel" Directory
Move All Your File (your laravel Project) to "Laravel" Directory, EXCEPT "Public" directory.
open your "Public" directory, and move to public_html or parent directory or one step before your "Public" directory ("../")
edit your index.php (previously in "Public" Directory)
Edit this code
require DIR.'/../vendor/autoload.php';
$app = require_once DIR.'/../bootstrap/app.php';
to
require __DIR__.'/laravel/vendor/autoload.php';
$app = require_once __DIR__.'/laravel/bootstrap/app.php';
and don't forget update your database connection on your .env file :)
I have found a way of generating the folder and it works.
I install composer for windows on my system , then navigate to the htdocs folder in xamp where i kept the file. then run this command
--composer installer--
After some mins, it downloaded some files and generate the vendor file itself.
i then zip the folder and upload it to my web host
Thanks every one