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
Related
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
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.
I've been recently working on a laravel app and when I finished it, I decided to upload it to a server through FTP. I've set up all the proper folders in the storage/ directory and chmodded them to 777. ModRewrite is setup on the server, but I still get a 500 ISE without any log stack displayed in browser. I don't have access to Apache logs, so cannot check what's wrong. Please, could you give me some suggestions on what can be wrong and how to fix this? (The app was working absolutely fine on my local server on PC)
Finally got it working by executing:
php composer.phar dump-autoload
php composer.phar install
(The second one only generated optimized class loaders, because everything was installed earlier)
php artisan key:generate
Assuming permissions are right, I'd say it has to do with missing encryption key.
I developed a php site using Laravel 5 and tried hosting it in a LAN Server running UBUNTU 14. But when I navigated the page I'm just getting a Blank Page. No errors at all. I inserted a simple echo statement in index.php and I got the relevant echo.
There can be many reason. If you are using Laravel 5.0, you will need at least PHP 5.4. For Laravel 5.1, you will need 5.5.9. But if you have installed PHP using sudo apt-get install php5 you are most likely to have PHP 5.5.9 or later. Because that is the default version for Ubuntu 14.04 LTS. try running php -v from terminal to check the version.
There can also be a Permission issue for storage folder.
From project root folder run following command,
sudo chmod 755 -R storage
Basically, laravel needs write access to storage folder to write a log in storage/log directory or to write a compiled view files in storage/framework/views etc. You can try 755 first. If that does not work try 777.
Laravel shows nothing on certain fatal errors. For instance a class that can't be found or the storage directory and subdirectories that should be writable for the web user (www-data). This should show up in the error log of the webserver.
I believe you have permissions issue chmod 755 storage folder located in the root of your web project. If that doesn't works do it 777.
The reason why echo in the index.php is working is because this is the first file called when you execute the laravel app and the index file calls services provider and other required files, in this process the app creates a cache file under storage/framework/views/ folder but these files does not have write permissions, but as you echo something you get that output because it has been called even before anything was called.
I have installed php oauth extension in ubuntu 110.10.
But on http://localhost/phpinfo.php in google chrome it is giving the following error:
Server error
The website encountered an error while retrieving http://localhost/phpinfo.php. It may be down for maintenance or configured incorrectly.
Here are some suggestions:
Reload this webpage later.
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
This means i am giving link to localhost then getting this error.
And in mozilla it is giving a blank screen.
It is not providing any information about installtion in php
How do i resolve this problem?
It may be permission error.. Please check your folder permissions. Bcz, Most of Ubuntu (linux) users can face this type of error.
by the author of question:
sudo chmod 0777 -R /var/www/phpinfo.php
I had a similar problem but the reason was because I had just restored my files into www from a Windows NTFS backup drive.
Naturally, with NTFS we don't have the same permissions of Ubuntu or any other Linux system.
Looking at the folders using nautilus showed incorrect owners and permissions.
How I fixed it...
Took ownership of my /var/www folder and its contents by doing this: chown khalid -R /var/www
Changed the mode of the www containing files like this: sudo chmod 644 -R /var/www
If you still get errors, do this: gksudo nautilus. Then go into your /var/www folder and change the permissions to allow owner/group read/write and check the box to execute as program. Also apply this to the sub-folders.
NOTE: Never give 777 permissions to a web folder/file. That's like keeping your front door key hanging in the front of your gate! However, if this is a machine that never sees the daylight of Internet, it shouldn't be an issue.