Deploying 1.0 To A Shared Host
This page describes a method of deploying a Symfony 1.0 project to a shared hosting envirnoment without Symfony installed.
Please read and understand Why Symfony is not safe in many shared hosting environments, a patch for some but not all shared hosts, and alternatives to shared hosting before following this HOWTO. Not all shared hosting environments can be made safe for Symfony. Others require a patch to Symfony. "Virtual machine" environments should be OK.
In order for this method to work, you need to meet the following conditions:
- A Shared Host with PHP5
- A functional copy of the project you plan to deploy in a local environment with Symfony 1.0 installed
- An FTP account to the host you plan to deploy to.
Preparing Your Local Project
Several things need to be dealt with before beginning to upload.
- Update Symfony - Make sure that you're using the latest update of Symfony 1.0 (at the time of this writing the most recent update is 1.0beta1). For example, if you are using a pear install of Symfony 1.0beta1 on linux, you might execute this command:
sudo pear upgrade symfony/symfony-beta
- Update Project - If you've recently updated your symfony install, be sure to update the project for the new version:
symfony upgrade 1.0
- Freeze Project - Now comes the easy part. When you freeze a project, like we're about to do, Symfony automatically packages the current pear libraries into the project directories and updates the configuration to point to these internal libraries. This tool has several purposes, of which easing deployment is one of the most useful. So, just issue the command in your root project directory, and watch the magic happen:
You will then see a long list of things which Symfony is doing, most of which involve copying files to their new locations. Most of these will be in the lib/ and data/ directories, but there are a few in other places, such as the web/ directory.
Preparing Your Host Space
Most shared hosting companies provide you with a base directory where you may upload your files. A standard layout for the subdirectory structure looks like this:
/ +-/public_ftp +-/public_html +-/tmp
There may be other folders, but they are not important to us.
Uploading the Files
Uploading the files is really quite easy, provided you know how to use an FTP client. If not, I would suggest you go read up on them, as they are very useful tools.
All you need to do is upload the following directories to the root folder of your webspace (Note: Do not upload the files into your public_html or similar folder. This is a severe security risk'''):
/ +-/apps +-/cache +-/config +-/data +-/lib +-/log +-/plugins (Optional, depending upon whether you have any plugins installed)
The next thing you need to do is upload the files in your project web/ directory into your remote public_html/ directory, or whatever directory you have that fulfills the function of holding your publically-viewable files.
/web/* => /public_html/
Now that you've uploaded the files, you need to ensure that the permissions of certain folders didn't get messed up while uploading.
- /cache : This folder should have world-writable permissions (777)
- /log : This folder should have world-writable permissions (777)
- All others: The other folders and file should be world-readable and executable (755)
There are a few other things you might want to do now that you're mostly finished.
I would definitely recommend that you deleted the dev controllers (/public_html/*_dev.php), since they are not needed and have the potential to deliver unwanted information to anyone attempting to hack your website.
Plugin Web Directories
- If you are on a host that supports symlinks, you can create symlinks from the main public_html directory to the plugin web directories.
- The universal method of fixing a problem like this is to simply copy the contents of the plugin web/ directories into your main public_html/ directory. research writing
Problem with stylesheet (css)
If the link to stylesheet doesn't work, add the following line to index.php:
Based on this thread (OVH context).
If you experience problems with this, simply ask on the forums or mailing list and you will most likely get an answer soon.