Permission issue with zf2 routing - php

In my main domain I have created a sub domain where I have uploaded my files of ZF2 but it it not allowing me to access the home page.
If I type <submdomainname>.<domainname>.com it is saying that:
Forbidden:
You don't have permission to access / on this server.
Additionally:
a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Sounds indeed like a server configuration issue.
Try once to put a simle index.php in your folder and see if you can open it:
index.php:
<?php
echo("Hello world");
And add it to your public folder and try to browse to it:
http://www.example.com/public/index.php
If that doesn't work, then you know at least that it is not related to ZF2.
After you tried this you can come back with more details on your problem.
You should add reading permission to the folder where you host your subdomain.

Related

Error 404 after migrating laravel 8 to a shared host

Hello everyone i am new to laravel and i hope someone can help me about my problem. I created a laravel project. After that I import it to cpanel using softaculous. Then, I made some changes base on what i research in the net to avoid showing important file like .env . I created a folder relative to public_html, let say the folder name is 'tamangbilang' where i put almost all of my code except the index.php. Inside my public_html folder, I have another folder named as 'tamangbilang' where my index.php resides. I have followed this instruction https://dev.to/pushpak1300/deploying-laravel7-app-on-shared-hosting-hostinger-31cj the only difference is that I put another folder inside public_html.I also did some changes on the index.php code
require __DIR__.'/../../tamangbilang/vendor/autoload.php';
$app = require_once __DIR__.'/../../tamangbilang/bootstrap/app.php';
Everything is working fine on my login page(my first page) but when I try to login, an error occur.
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
It seems like the connection between routes was lost. I did further testing and I notice that the code is working well only if there is an index.php, before the route in the url. example
http://my-sample-domain.org/tamangbilang/index.php/login
P.S. I don't have access for ssh.
go to bootstrap folder & open cache folder then delete config. after that please check your routes this error basically arises due to routes not found for that go to your project installed on local and write php artisan route: list check if the route is present or not.

Route stopped working

One of my routes is returning this error message:
Not Found
The requested resource /jackpots was not found on this server.
When I change the route name to anything else e.g. route-1, it works.
Server is running on http://127.0.0.1:8000/jackpots via artisan serve
How can I resolve this?
Edit 1:
Does not work:
Route::get('jackpots', 'JackpotsController#getIndex');
Works:
Route::get('jackpot', 'JackpotsController#getIndex');
Turns out the problem had nothing to do with anything in the routes/web.php script.
In my public directory, I also had a folder with the same name as a URL endpoint i.e.
Folder structure
public
|__jackpots
web/routes.php
Route::get('jackpots', 'JackpotsController#getIndex');
This somehow confuses the php server (as well as apache) into thinking you're trying to access the public/jackpots folder whose permissions won't allow you to do that.
I renamed the public/jackpots folder and the problem was resolved.

Laravel 5 is not working on shared hosting

I have tested my Laravel 5 project on localhost its working fine with this url - http://localhost/project-name/public/
Then I uploaded my project on shared hosting, I have made desirable changes for database on .env file then trying to access it with the url - http://companysite.com/folder/innerFolder/public/
but not working and getting 500 internal server error
I have gone through with other questions with the related but no answer lead me to my solution. I have done following steps
upload my project on root directory parallel to public_html
update to project/public/index.php
try to create subdomain pointing to my project but didn't succeed
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator at
webmaster#techphant.techphant.com to inform them of the time this
error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error
log.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
I have referred this link laravel.io
Finally, I did the job on my shared hosting. This is what I did
Setup a project Laravel 5 in localhost correctly configured
Double check the server configuration of PHP 5.4 (this because every
little change on .htaccess file may change that config)
Create a directory in the same level of public_html and put the
project inside of that folder.
Put the content of public (L5) directly on public_html (be aware of
don't overwrite the .htaccess file accidentally)
Now... This is the "tricky part"... I see this structure
mail
perl5
php
public_html
[framework-folder]
ssl
Inside of public_html I can see all the files of public directory of Laravel 5
Go to index.php and edit the line 22
From this
require __DIR__.'/../bootstrap/autoload.php';
To this
require __DIR__.'/../[framework-folder]/bootstrap/autoload.php';
And the line 36
From this
$app = require_once __DIR__.'/../bootstrap/app.php';
To this
$app = require_once __DIR__.'/../[framework-folder]/pulcro/bootstrap/app.php';
The final step is to edit the .htaccess file and add some lines
RewriteEngine On
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_URI} !^
RewriteRule ^(.*)$ /$1 [L]
and update [framework-folder]/server.php
From this
require_once __DIR__.'/public/index.php';
To this
require_once __DIR__.'/public_html/index.php';
Refresh the cache of my browser and.. Victory!!
I know that this is not the absolute right way to install the framework (God, I never spoke about Composer)
But... It's working for me now
Hope that this can help somebody in order to deploy Laravel 5
thanks to Neeraj Rathod, but I found this article more useful, and of course simple more!
WHY AM I GETTING A 500 INTERNAL SERVER ERROR MESSAGE?
in my case, by reading that article I found out from my "error pages" that the "group writable" permission must not be set for "index.php" file inside "public" folder and also for all folders through route. also you have to check that your shared hosting php version is more than 7.0
Everything Neeraj Rathod said, but also go to your project in vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php
In line number 1337, you can find the below code inside the addWhereExistsQuery method
$this->wheres[] = compact('type', 'operator', 'query', 'boolean');
you just remove the 'operator' parameter.
Thanks to this link:
compact(): Undefined variable: operator
now my laravel test project blog is online.

Symfony Backend showing 404

I have generated the Backend Application for the Symfony(1.4 and ORM Propel) project, in my Production env. But on calling the URL as http://www.mydomain.com/backend.php it is showing 404. Is there any config error or something like that..
Look inside your web folder and make sure that backend.php actually exists there, it might have been named something else [typo maybe]. Does mydomain.com work ?
Update
Disable/rename your .htaccess file temporarily and see if this fixes it. It looks like mod_rewrite is catching "backend.php" and passing it on as a module name.
The Problem was due to the Permission of the file i.e backend.php. I have changed the Owner/Group permission and the backend app started working. If any one had this kind of a problem, please check the file permissions, might help!
For rendering 404 page, the third parameter in your front controller must be false.
Like this:
ProjectConfiguration::getApplicationConfiguration('backend', 'dev', false);

codeigniter installation problem on shared host

my host account is something like:
~
~/public_html
~/public_html/system/application
to access my web, I need to put http://example.com/~userid in address bar
I install codeigniter in the ~/public_html directory, I can access http://example.com/~userid.
The Welcome page shows correctly, and the related user guide pages show correctly.
The problem is: if I create a new controller, and create new views, the web page just show "Error 404: Document Not Found". If I use http://example.com/~userid/welcome/index it has the same problem.
If I use base_url() function it shows http://example.com/~userid/
What should I do do fix this problem?
Thanks in advance!
Try http://example.com/~userid/index.php/welcome/index.
It looks like your URL rewriting is not set up or badly configured. This is the default way if URL rewriting is disabled.
EDIT See this page of the user guide, especially the section "Removing the index.php file" on how to set up URL rewriting.

Categories