How to install Symfony framework on shared hosting account? - frameworks

I have a questions while install Symfony framework on my shared hosting account.(hostmonster)
I can access SSH now, but I can not access httpd file.
so, I do not know how to set below setting using command line.
**
<Directory "/$data_dir/symfony/web/sf">
AllowOverride All
Allow from All
</Directory>
<VirtualHost *:80>
ServerName myapp.example.com
DocumentRoot "/home/steve/myproject/web"
DirectoryIndex index.php
Alias /sf /$data_dir/symfony/web/sf
<Directory "/home/steve/myproject/web">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
**
,
I tried this,
**
chmod 777 /home1/myaccount/php/data/symfony/web
chmod 777 /home1/myaccount/public_html/symfony/web
**
But nothing changed.
when access mydomain.com, it show like this
#!/usr/bin/env php
<?php
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <fabien.potencier#symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
chdir(dirname(__FILE__));
require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php');
include(sfCoreAutoload::getInstance()->getBaseDir().'/command/cli.php');
Please advice me how should I do .?
Thanks!

You need to enable mod_rewrite on your apache instance. If you cannot access the httpd configuration file, then you should create a .htaccess file in your web root.
Here is an example .htaccess file typical with symfony installs:
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /
# we skip all files with .something
#RewriteCond %{REQUEST_URI} \..+$
#RewriteCond %{REQUEST_URI} !\.html$
#RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

If you are seeing
#!/usr/bin/env php
<?php
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <fabien.potencier#symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
chdir(dirname(__FILE__));
require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php');
include(sfCoreAutoload::getInstance()->getBaseDir().'/command/cli.php');
when you head to yourdomain.com, you simply do not have PHP enabled. You may not even have it installed. A quick check is to create a file called info.php and put the following as it's contents
<?php phpinfo(); ?>
Upload info.php and navigate to yourdomain.com/info.php. If you are seeing the code you just entered you do not have php installed or enabled on your server. If you see a massive list of configuration items than I'm wrong.

Related

.htaccess redirection except specific paths

I am using opencart on a Godaddy hosting with cpanel. I am using a .htaccess file to do the following with no success.
I am trying to redirect everything from "http://northfalcons.com" or "http://www.northfalcons.com" to “https://northfalcons.com”.
But following three pages:
1.https://northfalcons.com/index.php?route=product/category&path=60
2.https://northfalcons.com/index.php?route=product/category&path=61
3.https://northfalcons.com/index.php?route=product/category&path=62
Need to be redirected to http instead of https, like follows:
1.http://northfalcons.com/index.php?route=product/category&path=60
2.http://northfalcons.com/index.php?route=product/category&path=61
3.http://northfalcons.com/index.php?route=product/category&path=62
How do I do this? Please help!
First You can Backup Your .htaccess files:
After Replace Following .htaccess code in Your Root .htaccess file:
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
# 2. In your opencart directory rename htaccess.txt to .htaccess.
# For any support issues please visit: http://www.opencart.com
Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Order deny,allow
Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule ^index\.php$ https://www.northfalcons.com? [R=301,L]
### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off
# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off
# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M
# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M
# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200
# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200
# 7. disable open_basedir limitations
# php_admin_value open_basedir none
I hope it's 100% working for you.
Thanks for asking...

WSOD coming on opening the 1st page of drupal 7 project

I have checked tail -n 20 /Applications/MAMP/logs/php_error.log. No errors in log. I am using MAMP.
Also I have added
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
in index.php.
My memory limit in php.ini is
memory_limit = 512M
Any suggestions?
Maybe you have to enable clean URLs? Add this to .htaccess file:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
Try to look at drupal's log.
With drush:
drush en dblog
drush ws
Error log was not coming because i was adding code in index.php, it should have been added at the end of the settings.php file:
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
After i checked logs, there were normal warnings. After that i enabled drush & it showed database is being connected but parameters are wrong.
Removing $database array from settings.php file and then installing like a fresh vanilla instance solved the issue.

Deploying Laravel 5 in Go Daddy Plesk

Im having problems deploying my Laravel 5 Project on Go Daddy Plesk . I'm getting Internal 500 Error. Here's the folder structure.
/Root Directory
/app
/boostrap
/config
/database
/storage
/resources
/vendor
/httpdocs
index.php
/css
/js
Then my server.php
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* #package Laravel
* #author Taylor Otwell <taylorotwell#gmail.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/httpdocs'.$uri))
{
return false;
}
require_once __DIR__.'/httpdocs/index.php';
So as you can see, I deleted my public folder in my laravel and transfered all the public contents inside httpdocs but I already changed the path on server.php
did I missed anything?
My .htaccess under httpdocs
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
the one reason is you wouldn't have set permission for your public folder. Another you would need 5.5+ php version in order to make Laravel work. First set permission and try changing php version. I strongly believe this would work.

Apache virtual host on a specific directory

I need my site to have a virtual host on a specific directory for my zend application. When user enters www.example.com it should go to normal document root but when user navigates to www.example.com/cms it should go to /var/www/cms/public which its .htaccess file is like this:
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
On localhost I added this lines to /etc/apache/httpd-vhosts.conf:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/var/www/cms/public"
ServerName persian_literature
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "/var/www/cms/public">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Now http://localhost/ goes to /var/www/cms/public and every thing works. My question is how should I change change above code, to force http://localhost/ to be the normal directory root (so I could use other applications) and http://localhost/cms to be the virtual host?
A virtual host is done at the hostname/domainname level, not at a directory level. You can use an alias to point the URI /cms to some other directory on your server by putting
Alias /cms /var/www/cms/public
in a .conf file (this will not work in .htaccess)
Maybe a symlink (symbolic link)? You still should have the entry of course. And you'll have to put in the config (vhost config I think, maybe .htaccess) that apache should follow the symlink.

After setting up virtual host in zend framework project image are not visible

My project structure is like following ---
/
public
.htaccess
index.php
template ...........
data
uploads (all the uploaded image by this application)
.....................
like these
before setting up virtual host for this project alls are working good but after setting up i can not able to see the uploaded images anywhere.
I might be happening for following reason
my virtual host pointing public directory but uploaded images are under uploads directory.
my question is that without changing the uploads directory to public directory how can i able to show my images
Followin is my .htaccess file ----------
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
and on apache file host setting is as following---------
<VirtualHost 192.168.0.3:80>
DocumentRoot "/var/www/toletbd/public"
ServerName hometolet.local
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "/var/www/toletbd/public">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Thanks
Ruzdi
Create a symbolic link for data folder inside your public folder (since this is your document-root which is accessible to public.
Run this command:
cd /var/www/toletbd/public
ln -nfs /var/www/toletbd/data/images images
Make sure, the above data/images folder is accessible to "apache" user otherwise you will get a permission-denied error.
Now, you can use it something like this:
<img src="/images...">
To deliver images that are stored in a folder outside the web root, you could create an ImageController with a getAction() method that:
Looks for the image in the folder
Sets the appropriate mime-type headers in the response
Performs a readfile() to deliver the content.
Of course, you would need to add a route that maps those image urls to this controller/action.
#Sahal's symlink idea is probably better, since it doesn't require another full dispatch cycle to deliver what is essentially just static content. But if your hosting somehow doesn't allow you to symlink, then this could serve as a workaround, though an admittedly less-performant one.