Cakephp 2.9 Internal 500 server error - php

I got a project for some enhancement which is running on CakePHP 2.9.
which is a ERP for govt Hospitals, i need work on admin panel for some enhancements.
I copied the project folder in localhost
/var/www/html/
and already imported schema into my phpmyadmin named esic.
and then i configured my esic/app/config/database.php file to the database(esic).
When I'm accessing the project from localhost, it is showing an error.
localhost/esic/
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#localhost 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.
I read the issue on Google and CakePHP official site but I didn't understand anything.
Please help me to figure out this problem.
Please let me know if some other details required.
Note: All other projects are working fine.

500 internal server occurs when the desired file or URL is not accessible.
AS you said all other projects are running on your localhost then please check that your .htaccess file is correct on this project.
Or else check other URL of the project.
Link: https://book.cakephp.org/2.0/en/installation/url-rewriting.html

If you are using linux environment try maybe only the permission of the folder. I somehow encounter that problem.
sudo chmod -R 755 /var/www/html/esic
or
sudo chmod -R 777 /var/www/html/esic

Related

Laravel 8 ERROR 500 - INTERNAL SERVER ERROR in cpanel

I have successfully used Laravel on my local machine and it worked. But, when I put it on my online cPanel I can access the login page, but any other page behind the login page is producing the error
ERROR 500 - INTERNAL SERVER ERROR
I have checked my online PHP version and it's 7.4.14, while the local version is PHP 7.4.9. I believe that it should not make much difference.
I would be grateful for anything that can helpful.
I've also checked the MySQL version:
cPanel version 5.6.41-84.1
local version 5.7.14
The information shared is not enough to provide a solution. You can try generating the error log first. It looks like the permission for your log file is not set.
Can you try these two command to provide permission on laravel storage folder and bootstrap. Go to the application directory and issue following commands.
chmod 777 -R storage
chmod 777 -R bootstrap/cache

Symfony 3.3.9 deployment to PHP 5.6 wont render default application

I am struggling to get a default Symfony application from PhpStorm 2017.2.1 which works locally (Windows), but seemingly will not deploy to a remote server (Linux) and run.
Windows setup:
Windows 10, PHPstorm 2017.2.1, php5.6, symfony 3.3.9, default symfony app (namely, I installed Symfony and am using their default app -- no personally written code). This works, when run with "php bin/console server:run" from a command prompt, and "localhost:8000" in a broswer, generating "Welcome to Symfony 3.3.9" "Your application is now ready. You can start working...."
I believe nothing is wrong here.
Remote Linux Setup:
Shared hosting, bash 4.2.46, I don't have root access, everything supposed to go in the public_html directory. A simple one line phpinfo.php file containing only
"<?php phpinfo(); ?>"
placed in that directory will render when accessing
'www.example.com/phpinfo.php'
the usual phpinfo() dump, thus I believe the PHP server is operational. I'm not sure if there is some configuration error with apache that is causing problems on the server for something more complicated like a default symfony application, or whether the issue is my PHPstorm configuration.
PHPstorm deploy configuration:
SFTP to www.example.com (test connection works, files will upload).
root path: /home/example/public_html
username and password work, auth type=password.
Web server root URL=sftp://ftp.example.com,
and it does allow files to be browsed on the server.
PHPstorm mappings:
local path=c:\blah (works, since files upload)
deployment path on server=/
web path on server=/web
I have only one mapping.
PHPstorm excluded paths:
empty
Upload and Prepare:
Cleared Linux public_html directory of everything including . files. Uploaded the local app to remote Linux server. Logged on via SSH and chmod everything public_html and under to 777 (yes, horrible security practice, but this is a test, and there is nothing else on the domain at the moment, and this will rid me of any security protection issues for test).
Test results, in order:
Test1: Browsing to www.example.com results in
**
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
**
Test 2: Browsing to www.example.com/web results in
**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#example.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.
**
Logs: Performing
ls -alsgR | grep log
produces nothing that appears to be a server logfile.
What process do I follow to get the default application to work?
This appears to have been a web server issue.
My web hosting provider would not allow me to see the httpd.conf file for this shared hosting situation, but did run test cases for me, and for whatever the configuration is, determined that
1. All files within public_html/ need to be have permissions 644 (777 not good enough)
2. All directories within public_html/ need to have permissions 755 (777 not good enough).
The two bash commands to do this, run after cd to the public_html/ folder are
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
Very frustrating problem solved w.r.t. the server.
Although I haven't fully checked it out, PHPstorm does appear to have,
under file/settings/Build/Deployment/Options, an ability to override default
protections for files and directories, so I believe it likely that any
problems occurring with PHPstorm can be fixed by configuration of those
overrides.

Laravel 5.2 HTTP error 500

I have made a website with Laravel 5.2 and now want to put it in my VPS. I installed LAMP on my server, and put my project in /www/ directory. I can access my server, however, when I try to access /public, I get an HTTP 500 error. Both my /bootstrap/cache and /storage are writable. Do you have any suggestions, what should I do? Thanks for your help!
Sorry, just made a mistake on changing rights of bootstrap and storage folders... Very sorry... Everything works now!

500 Internal Server Error with bare git repo after post-receive hook

I think this is the last issue I am having with setting up Git on this dedicated server (with cpanel).
I have created a bare repo on my PC, placed it on the server: /home/cpaneluser/git-repos/
Edited /home/cpaneluser/git-repos/myproject.git/hooks/post-receive and it's contents are:
#!/bin/sh
GIT_WORK_TREE=/home/cpaneluser/public_html GIT_DIR=/home/cpaneluser/git-repos/myproject.git git checkout -f
I gave it 0764 permission so the owner can execute it. It seems to get executed fine because it does actually put the files of my repo into my public_html directory as expected.
I then navigate to the domain in my browser and get an Internal Server Error with it's generic, unhelpful, error message The server encountered an internal error or misconfiguration and was unable to complete your request.
What is really weird, is if I manually edit the 'index.php' file located in the webroot 'public_html', it seems to magically fix everything. However, doing this edit puts the get repo out of sync with my local end.
Does anyone have any idea why I am getting an internet server error after running the 'post-receive' hook, which performs a checkout -f. And how can I fix this?
Thank you.
Adding umask 0022 solved my permission problems.
#!/bin/sh
umask 0022
GIT_WORK_TREE=/home/cpaneluser/public_html GIT_DIR=/home/cpaneluser/git-repos/myproject.git git checkout -f

500 Internal Server - Apache

My site frequently displays 500 Internal Server Error. Restarting apache, brings the site back to normal state. Other sites running on the same server does not have this issue. Apache error log have no information related to this. The apache loglevel of this site is set as "warn".
What may be the reason for this ?
My site is written on PHP and deployed in linux server.
If you have suphp installed it might be e permissions problem - if its installed all the files need to have chmod set to 644 and all thefolders - 755
Please check the folder necessary permissions. Then in index.php file add
ini_set('display_errors', 1);
to display error reports. So that you can find the error.

Categories