Deployment of PHP app on AWS Elasticbeanstalk - php

I zipped all my files before uploading it to elastic beanstalk. However I'm getting an error message:
Not Found
The requested URL /was not found on this server.
I did some research and came across the following post:
https://forums.aws.amazon.com/thread.jspa?threadID=127927
"The '403 Forbidden' error was because of the file structure of the zip folder. In order to upload properly please highlight/select all the contents "inside" the folder then you can compress/zip the contents and not the folder itself. That is, you cannot have a nested folder inside the zip."
I have done as told, except that I have selected the files AND 2 folders which contain some files. This may be causing the issue(?)
What should I do?

As you have mentioned that you are facing “The requested URL /was not found on this server”, you need to ensure the following:
1: Make sure your application has the file that .htaccess is
redirecting to your welcome page. 2: You need to set the public
folder as the root folder. For this, go to the Elastic Beanstalk
Console and Click on “Configurations”, then modify Software . Update
the “Document root” to the folder that contains your site's
default page. For example /public if the welcome page is in a folder
named public.

Related

Migrate Laravel 8 to a subfolder of a shared host

I am using a shared host. Inside my shared host public_html, I have a folder named project1. This folder contains the files for my main site.
I want to create a new folder (e.g. Project2) for my new Laravel 8 application. I've tried putting all my file inside public_html. It is working when I visit the site using the example.com/project2/public/index.php URL format. But the problem with this is that my important file like the .env, will be public.
I've also tried this but when I tried to run the project, it gave me a 500 error.
Try changing the name of server.php file to index.php and copy .htaccess file from public folder to same location where server.php

PHP - How to use the same set of files in each subdirectory?

You see how facebook works, like if my profile is
www.facebook.com/myusername
then there is a specific index.php file and other lots of files that open when I open facebook.com/myusername.
Now I believe it is highly unlikely that Facebook copied the same files into each and every user's username directory.
How else would it work?
I'll be having many different users using the same application, i.e. the same set of files with minor changes in one or two files. Do I necessarily have to copy all the files into all the user directories each time?
I tried putting an index.php file in the subdirectory that contains this code:
<?php
require '../index.php';
?>
Now even though that runs the ../index.php file inside the subdirectory, but when the ../index.php file redirects to say another file named 'otherfile.php', then it gives a 404 not found error, because 'otherfile.php' is not present in the subdirectory, it is present in the parent directory.
How do I solve this problem?

I can' upload file on my shared folder using laravel

I have a laravel project that i hosted on a shared host. using the system i saw on Laravel Deploy Instruction
So am suppose to upload image, -- user's image. To the public_html folder but since am not in the public_html so the users can't upload their image. since my code lie out side the public_html folder and it doesn't allow write permission for general users. so i tried uploading it to 'storage folder' (ie the my laravel project folder, that is in the sane level as the www 'public_html' folder.) it works i can see the image in the storage folder but i cant access because it is behind the public_html folder. and whatever can't be point to. Example project/storage/app/public is the folder that has the user image if i point to it in <img src="project/storage/app/public/user.png" > it wont display because the browser looks for project/storage/app/public inside the public_html folder whereas it is outside the public_html. So can someone touch on this. Thanks guys. Or is htaccess use in this case?
you need to create symlink to Your storage folder .
please see this answer:
Laravel 5 - How to access image uploaded in storage within View?
the above method given by the link works for offline however not all shared hosting site support artisan Laravel sysmlink. so the absolute and best way to do this is with php symlink() function From PHP MANUAL
so just add this code to your web.php ie project\route\web.php
Route::get('/symlink', function()
{
if(symlink('/home/username/projectfolder/storage/app/public', '/home/username/public_html/storage')){
echo "We rock yea stackoverflow!!!! best programming software";}
});
so the username is the name of your home dir

Joomla 3.x Administrator Error : 0 Cannot write to log

I wrote a joomla 3.x simple web site on my local machine and it worked fine. I deployed this to 1&1.com and the front end works fine but the control panel throws an error each time I try to log in saying "0: cannot write to log".
I have tried relative and absolute paths to the log folder in the $log_path parameter of the configuration.php and changed the permissions to the folder and files to all sorts of combinations and still I get the same error? I have created a new log folder and pointed the to that and still no joy?
has anyone come across this error using 1&1.com? I see some suggestions that 1&1.com are really bad with joomla support and I may be best trying another host? I am in 30 day money back guarantee so that is going to be my next move.
Cheers
Alex
First check this link https://joomla.stackexchange.com/questions/4673/error-0-cannot-open-file-for-writing-log-while-updating and if everything is fine and still this doesnt help then proceed to next step
Step:1 get the base path by writing this code to a file and uploading it through ftp
<?php
$basepath = getcwd();
echo "Your base Path is: ";
echo $basepath;
?>
When you run that file suppose it is named base.php then go to http://yoursite.com/base.php and get your base path.
Step:2 Create a new log and tmp folder
Now as You have got the base path, create a folder in your main joomla installation and name it newlog with permission 755.
Step:3 Change path in GLobal Configuration
In your global configuration give the base path appending the new folder path. Suppose you get basepath as /var/www/joomla then uou give the log path as
/var/www/joomla/newlog
I imagine you might have asked 1&1 already, it may be something they know very well.
Anyway make sure you have the correct configuration paths (absolute!) in the configuration.php and that the folder and its files are writable by the user who runs the website instance.
Also clear /cache and /administrator/cache for good measure, as they may have cached some non-authenticated results.

cannot directly call the php file inside folders using the directory path

I have one root folder called GASS where I put all my php files and other related folders (templates,images,js,fonts,css)inside. When i try to run my project in localhost, http://localhost/GASS/alarm_A16GSM.php everything went smoothly. I wanted to change the URL to be more specific, http://localhost/GASS/alarmsystem/16zone/A16/overview.php thus i rename the php file and put it inside folders.
GASS
alarm-system
16-zone
A16
overview
However when i try to run the new URL,the page shows error.This is the error message:
Warning: include(templates/header.php): failed to open stream: No such file or directory in .....
Code for the first URL where the page load successfully.
<div class="overview"><a href="alarm_A16GSM.php" id="overview-selected"><span>
Code for the new URL where the page shows error.
<a href="alarm-system/16-zone/A16/overview.php" id="overview-selected">
It seems like i need to configure something which i do not know what it is.
How am i going to load the page successfully using the new URL? How am i going to traverse four levels up to the root directory so that the page load successfully? Why i cannot directly call the php file using the(alarm-system/16-zone/A16/overview.php) path?
p/s: sorry for my bad English.
It looks like there is a line in your Php file, probably like
include 'templates/header.php';
Include can't find the file using that relative path, because you moved the calling file.
Probably you could change that to
include '../../../../templates/header.php';
To get back down to the GASS folder that apparently has a folder called 'templates' with a file 'header.php' that is required.
An absolute path would be good, instead but it refers to the filesystem path, not webserver path - so you'd need to know your web root folder name on the server.
Copying all the folders (templates,images,js,fonts,css) to the folder overview will solve the issue. Now there is no template file on the folder 'overview' so header.php is failed to load. Another option is create a file save all the included file path and call this file.

Categories