I need to setup Symfony on a shared host that runs on windows IIS. The domain directs to the root folder of the host. Which means no /public_html or /htdocs.
Is there any way to configure Symfony in a way that if I move the contents in "/web" to the root folder of my shared hosting account with the rest of the folders (app, config, tests etc...) , it would still work ?
Yes definitely you can do this.
Just do:
Open - lib\symfony\config\sfProjectConfiguration.class.php
Find - $this->setWebDir($rootDir.DIRECTORY_SEPARATOR.'web'); function
Modify - "web" folder by whatever path or directory you want
On linux, you can do symbolic links to a directory. The windows equivalent of a symlink to the root directory named web would solve your problem I guess...
Symfony on IIS
In the first case, the webserver is only used for our symfony project, and the URL is something like http://myproject/.
Assuming the directory in which you created the directory myapp is c:\myproject\, configure the root directory of your server to be c:\myproject\web (in IIS administration console).
Related
I want to deploy the Laravel project to my shared hosting.
When I go to my site main domain (example.com) It displays all directory and files but (example.com/public) works fine.
What if I just create an index.php file in the project root directory with following code
<?php
header('Location: ./public');
?>
It just redirects me to example.com/public.
Just tell me if there will be an issue that may occur at any point?
I am new to Laravel.
I don't care to remove the public directory. I only care if someone goes to example.com then it just redirects example.com/public to work fine.
Update
Just keep it short and simple answer (Yes/No) then explain it.
Is there will be an issue that occurs with the above steps (actions)? (Yes/No)
did you point your vhost to to the public directory?
For Apache
DocumentRoot [Laravel root direcoty]/public
For Nginx
root [Laravel root direcoty]/public;
Laravel Deploment
I'd suggest the easy way, by create a symbolic link of public_html and link it to your laravel project's public directory. don't forget to set your project folder permission.
here's the example: https://blog.netgloo.com/2016/01/29/deploy-laravel-application-on-shared-hosting/
This is Bablu Ahmed. I want to upload my laravel 5.5 project into cpanel and my domain is an addon domain name is w3public.com and it's root directory is not inside the public_html it is outside the public_html (www.w3public.com). I have separated the project's files into two directories, one is www.w3public.com and another is laravel and I moved public folder's files into www.w3public.com and all other files into the laravel folder in cpanel that is given in screenshot below. I have also modified the index.php file of www.w3public.com as follows:
require __DIR__.'/../../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../../laravel/bootstrap/app.php';
But it is not working. Can anyone help me with appropriate solutions?
Screenshot:
Your application should be installed in www.w3public.com and then change the root path from cpanel domains to the public folder inside laravel.
The best way to transfer files is git or the likes, but if they don't have it (usually is the case in shared hosting), you should use a ftp client, and if they don't allow that either, you can upload files/folders from cpanel (way too slow sadly).
If you use git be careful since by default vendor folder is in the .gitignore (you have to run "composer update --no-dev" after all the files are transferred)
Make sure also that your ".env" (usually in .gitignore too, so you prob have to make one) file have your server database info.
I logged into openshift application using filezilla.
Earlier for normal website i just drag and drop files at www directory its works pretty fine but in at this case i found some other folders and i am unable to get an idea where should i drop my php app in at this particular machine. I am unable to locate where the index file is located also. if I am using git for the deployment of application it works pretty fine.
Openshift makes it easy to upload program changes by checking out the container. Adding the code and the pushing it.
see How to git-checkout first application created on OpenShift? on how to do that.
I'm not sure about the structure when you use filezilla to connect to the Openshift container, but it should be similar to the checked out structure
index.php Template PHP index page
.openshift/ Location for OpenShift specific files
action_hooks/ See the Action Hooks documentation
markers/ See the Markers section below
pear.txt List of pears to install
Depending on what cartridge you are using:
php/ # for backward compatibility with OpenShift Origin v1/v2
public/ # Zend Framework v1/v2, Laravel, FuelPHP, Surebert etc.
public_html/ # Apache per-user web directories, Slim Framework etc.
web/ # Symfony etc.
www/ # Nette etc.
./ # Drupal, Wordpress, CakePHP, CodeIgniter, Joomla, Kohana, PIP etc.
See https://developers.openshift.com/en/php-repository-layout.html for more details.
try this:
goto app-root > repo
put your files in this folder. if you put a index.php, it will be accessible through the web.
but there's a more convenient method.
create a folder name php inside the repo folder and openshift will use it as a document root. which means all other files will be unaccessible from the public.
conclusion
put all other files in app-root>repo. put the index.php in the php folder and link other files accordingly.
optional:
use GIT. its easy and way more convenient than sftp. you need to learn only 4 commands.
git add
git commit
git push
git clone
that's it!
edit1
IF php/ dir exists THEN DocumentRoot=php/
ELSE IF public/ dir exists THEN DocumentRoot=public/
ELSE IF public_html/ dir exists THEN DocumentRoot=public_html/
ELSE IF web/ dir exists THEN DocumentRoot=web/
ELSE IF www/ dir exists THEN DocumentRoot=www/
ELSE DocumentRoot=/
above is the priority of document roots in openshift. use whatever you like.
Had the same problem. You need to turn off APC cache. This can be done via an .htaccess file:
php_flag apc.cache_by_default Off
I'm working with a server that I can only use FTP, so I have my laravel project in a folder inside www named 'laravel', I want to see my project by clicking domain.com/laravel, inside this www folder I have others folders with others projects I don't think that I can use the root to upload my laravel project like I saw in many tutorials.
Now If I visit domain.com/laravel i only see a list of directories ,Is possible to view my project working at /laravel ??
Thanks!
You would either need to add a custom mod rewrite config or configure your apache virtual host directory to be laravel/public
If you setup your document root as C:\xampp\htdocs\ and you create a project folder named "ProjectX" where you include all your project files and folders and subfolders, how are you going to make your project runnable with url "http://localhost/projectx" ? I would like to learn how your config and routes files you included in your projects are changed ?
you can refer below link
http://book.cakephp.org/1.3/en/view/912/Installation
cheers
I would not run them as "localhost".
If you link css/js/img absolute to the / root, you will run into problems later on your life server.
it is always best to use virtual hosts and simulate the "real life" on your system:
http://www.dereuromark.de/2011/05/29/working-with-domains-locally/
You can create a folder projectx in C:\xampp\htdocs\
Then copy all the CakePHP files in C:\xampp\htdocs\projectx\ (including .htaccess, app\, lib\ and all. Setup the salt, cypher, db files and you should be able to access it through http://localhost/projectx/