zend project on shared hosting? - php

I created a zend project on localhost on ubuntu OS and it is working perfectly on my local system. Now I want to upload this project online. I purchased domain name and hosting. I got following directory structure to upload files.
/www.example.com/web/content/
So www.example.com is pointing to /www.example.com/web/content/ folder. This directory structure is unchangeable. I put all public folder files to /www.example.com/web/content/ and application, library and tests folders into /www.example.com/web/. So it is the same directory as my local system but only public folder is renamed to content folder.
Now homepage is successfully shown but whenver I click any link or redirect to any other webpage, I got following error.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root#localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2 Server at example.com Port 80
Any idea ?
Thanks

Internal server (HTTP 500) errors can occur for many reasons. You should check your web server's error log for more details. If you don't have access to your vhosts' error log, ask your host to see what's going wrong.

It is solved after reading following thread:
http://www.zfforums.com/zend-framework-general-discussions-1/installation-configuration-3/problems-1and1-hosting-560.html
So it is working using following .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Related

Laravel 5.5 on Godaddy. Producing error 500. internal server Error

I have uploaded my laravel files to a Godaddy shared hosting.
My folder structure is like so
/mediservices
all-other-laravel-files-and-folders
/public_html
public
index.php
The content of the index.php in the public folder in public_html has been edited to point to the medsirvices folder like so -
22. require __DIR__.'/../../mediservices/bootstrap/autoload.php';
34. $app = require_once __DIR__.'/../../mediservices/bootstrap/app.php';
I have added the following to the .htaccess file in the public_html folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^mediservices
RewriteRule ^(.*)$ mediservices/$1 [L]
</IfModule>
I still get a 500 Internal Server Error when i go to the domain.
The full message is
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#medcommhospital.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.
Following the comments I can suggest the following. You need to make it clear if you want to serve the site under the domain root or under a folder on a domain.
Keep an eye on your logs, they tell you what the issue is. And make sure it actually is the same error, even a small change in details can give you more information.
Serve site under domain root
If you want to server your site/Laravel project under the domain root so on example.org/ it should be configured like the following.
# Contains all other laravel files
mediservices/
...
public_html/ <webserver root> <laravel public dir>
index.php
.htaccess
Your reference to your bootstrap in index.php should be.
__DIR__ . '/../mediservices/bootstrap/autoload.php'
Your .htaccess file should not need rewrite rules, so you can likely remove that configuration.
Serve site under folder on domain
However if you wish to serve your project from the folder mediservices/ after the domain part in the URL, so like example.org/mediservices/, and redirect users to that folder, you can keep the .htaccess rewrite rules you have, but you'll have to move your Laravel public folder to the following:
# Contains all other laravel files
mediservices/
...
public_html/ <webserver root>
mediservices/ <laravel public dir>
index.php
.htaccess <should stay under the public_html/ folder>
The references you use in index.php should be as you had, which is the following.
__DIR__ . '/../../mediservices/bootstrap/autoload.php'

slim rest api work fine on localhost but it returning error 500 on shared hosting?

I have developed an application using angualar and php with slim and it works fine in localhost , but slim rest api showing error code 500 on shared hosting, How to solve this issue ?
when i try to check it showing below message
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, webmaster#demoems.aaaaa.com
and inform them of the time the error occurred, and anything you might
have done that may have caused the 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.
If you are using Apache
you must create .htaccess file with this configuration
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
Also you must config your shared hosting apache config file
Find var/www/ Block
and change
this
AllowOverride none
To
AllowOverride All
problem solved by setting folder ,file permission to 755,644

500 Internal Server Error with Wamp server

I've created a web service using php, slim and mysql but when I try to access the urls it gives me "The server encountered an internal error or misconfiguration and was unable to complete your request."
When I check the log it gives me :
C:/wamp/www/task_manager/.htaccess: Invalid command '.htaccess', perhaps misspelled or defined by a module not included in the server configuration
I checked few things online and I can ensure you that rewrite_module is installed and activated (not commented in the http.config
does anyone know how to fix that?
I ll attach the content of my .htaccess
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]
Remove the line .htaccess from your .htaccess file.
if you install new wamp on your system,
and you are using htaccess in your project to rewrite some urls first you need:
Click on wamp icon and Go to "Apache" Then Click on "Apache Modules"
and make sure your RE WRITE extension should be checked.

Getting an error when I visit http://localhost

I am trying to access localhost on my xampp via the Chrome browser but I get this error message:
Object not found!
The requested URL was not found on this server. If you entered the
URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
Apache and MySQL are turned on so I don't understand.
You can access "localhost" just fine.
The "404: file not found" error indicates the server can't find the requested file once you've connected to localhost.
ADDENDUM:
Maybe try to create a regular html file called test.html in one of
your vhosts that is not working. Then try to visit that url. That
should give you some clue as to what may be the problem. – Gohn67
This is good advice. Try it. Specifically:
1) Create the following five files:
C:/xampp/htdocs/dummy-host.localhost/test.html
C:/xampp/htdocs/my/test.html
C:/xampp/htdocs/launcher/public_html/test.html
C:/xampp/htdocs/website/httpdocs/test.html
C:/xampp/htdocs/my/test.html
2) Make sure each of these directories exist, and each has a "test.html" with the words "TESTING 1...2...3" in it
3) Try each of these five URLs in your browser:
http://localhost/test.html
http://itutormaths.web/test.html
http://itutormaths.mod/test.html
http://itutormaths.hub/test.html
http://my.itm/test.html
4) Report back the exact error you get from each browser URL
Navigate here:
http://localhost/
If that works, everything is okay.
Paste wordpress to xampp/htdocs, and you should not get any error.
I had a similar issue and this is how I resolved it:
Open the httpd:conf file on the Apache module in XAMPP (click the Congif button)
Scroll through the file - after the first set of comments (#) there is a line of code which says 'Listen 80'. Change this to 81 (or whatever other port you want to use).
Open web browser and explicitly define the port in the web address:
127.0.0.1:81
The may or may work for you; I initially had the issue that Apache wouldn't start at all, which is why I changed the port number (couldn't be bothered to figure out which service was using port 80 - if you want to you can use the command netstats -a or netstats -b in command prompt to figure it out)
Hope this helps
I just encountered this and solve this by creating .htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /yourfoldername/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

I am getting the following error with my .htaccess file

I am getting a Internal Server Error when i use my htaccess file on a sub domain but it works fine with standard domains. I dont really understand how the htaccess file works totally so any help would be greatly aprricated.
.htaccess file
RewriteEngine on
RewriteRule ^([^/\.]+)\.html index.php?act=$1 [L]
Internal Server Error
The server encountered an internal
error or misconfiguration and was
unable to complete your request.
Please contact the server
administrator,
webmaster#-----.com
and inform them of the time the error
occurred, and anything you might have
done that may have caused the 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.
When using RewriteRules, always, always use the conditions associated with the involved module. In case the module is not available, rewrites won't work (and your website will probably be broken because it relies on rewrite rules ;-)) but you won't get a 500 error:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^([^/\.]+)\.html index.php?act=$1 [L]
</IfModule>
If you don't get a 500 error after this, then the rewrite module is not loaded in your subdomain.
If you still get it, it's probably a redirect loop.
This is a punt - may be well off base.
Is your subdomain is based in a folder within the standard webroot?
ie subdomain.server.com is rooted in a folder subdomain within the webroot folder for server.com. So the webroot is something like /httpdocs/ and the subdomain is /httpdocs/subdomain/.
You may just need to define the RewriteBase as that folder
RewriteEngine on
RewriteBase /subdomain/
RewriteRule ^([^/\.]+)\.html index.php?act=$1 [L]
Does that help?

Categories