How to upload Yii project on hosting sites? - php

I want to upload my Yii project on hosting sites but it seems that Yii framework is not working right in local computer. My directory structure is like this:
xampp/
htdocs/
passcollege/
webroot/
application
framework
I placed my Yii project in application folder and Yii libraries on framework folder its all working fine in my pc but when I uploaded it they (hosting site) give me a directory /home/user/public_html.
I placed the passcollege folder from my machine to their (hosting site) public_html folder, but when I accessed my site I need to manually select folders to reach Yii frameworks index.php.

You shouldn't store the framework in the web root. For the Yii application to show automatically you need to put the index.php file in the /home/user/public_html folder. I'd suggest a directory structure like this on your host:
/home/user/public_html
{contents of application folder}
/home/user/framework/
This is the same directory for Yii to find assuming you have it set up as the default.

Related

How to configure codeigniter with site files in xampp?

I've recently taken over a project from another developer, let's call it EBAY. I'm struggling to get their live site up and running on my local server for testing and debugging. They've built a web app using CodeIgniter. In their file manager on cPanel they've placed the ci folder at the root, not in the public_html folder.
I've copied their public_html files and their ci folder into my xampp's htdocs folder. The issue is that the site only loads when the ci folder is placed WITHIN the folder for EBAY. Oherwise when I load the localhost site it gives an error message that it cannot find the codeigniter folder inside EBAY folder.
How is this? How can the application run with the ci folder at the root on the live site, but when I have migrated it to the htdocs of xampp it is expecting the ci folder to be inside the EBAY folder?
This kind of configuration is quite common nowadays, and if you look at Linux or Pear you'll discover that PHP files sometimes are completely in other directories than the webserver.
The ideas behind this are pretty simple but effective:
Any files can't be reached from the network / internet.
So they can't be altered, downloaded or even just viewed.
PHP (or other) Libraries are clearly separated from individual code and can't be easily mixed up or accidentally be deleted.
Access rights are easier to control and perhaps even that differently than the files in the webfolder.
Ok, so far an explanation. Now about your issue with it:
You've currently a webfolder htdocs in Xampp and in general you can use a subfolder as the webfolder and in htdocs directly you place the project files that are not public. You've to adjust then where the domain is pointing (docroot and/or virtual hosts).

PHP - First Time Installation of Laravel 4 on VPS

Hey so I am completely new to Laravel 4 and have some basic questions regarding my first time installation that I was unable to find answers to anywhere else on-line. I am planning of hosting a standard website with a fully dynamic web back end and a RESTful API using the framework. I have been following this installation guide and am essentially at the part where I type laravel new projectDir and it creates a new instance of Laravel in the provided directory.
Now my main public directory is public_html, is it recommended to install Laravel 4 directly into that directory. So is something like laravel new public_html recommended? I have found many other questions here that seem to suggest that this is not the safest solution. Should I make a separate directory inside public_html, is it necessary for what I am planning on doing with laravel?
Also, I would like to keep my URL's as neat as possible and would like them primarily to be www.domain-name.com/pagename for the website. Will creating a directory inside of public_html disable me from doing so?
Lastly I had some issues with routing my URL's when I tried to install a different framework on this server. Are there any server/Apache settings that would impact how URL's are routed with laravel that I should disable/enable before I install Laravel into a directory?
you would not put the base Laravel folder in public_html.
In a Laravel directory structure, which gets created when you do the laravel new command, there is a directory called public. This is what you map your web root to. So on my vps, I have a folder called /var/site/mywebapp which was created by the command:
laravel new mywebapp
In nginx (which I much prefer over Apache), I map my server root to:
/var/sites/mywebapp/public
In the public folder is an index.php that Laravel uses to run your whole app/site. The rest of the framework is outside of the web root and is not accessible by HTTP.
As for your URL issues, consult the documentation for how to properly configure your mod_rewrite (assuming Apache).
Also, Dayle Rees, a prominent member of the Laravel community (and core contributor), has a github of sample web server configs here:
https://github.com/daylerees/laravel-website-configs
When you install Laravel it will create a public folder, along with app, bootstrap and vendor folders.
The public folder is essentially your public_html folder where you want your host/apache to point to when viewing the root of your website. So mydomain.com should land directly within the public folder.
You can rename the public folder to public_html just be sure to also update bootstrap/paths.php paths value
'public' => __DIR__.'/../public',
// change to
'public' => __DIR__.'/../public_html',
Laravel will create a .htaccess file for you, which will grab URLs and redirect them to public/index.php which will process Laravel accordingly.
So to answer the question, you install Laravel one folder back from public_html and then you can rename public to public_html if your host requires.

CodeIgniter and normal website

I have a web hosting which hold a website I run.
I'm learning CodeIgniter so I would like to upload it a file in that web hosting and run some test and learn, CodeIgniter just for test, and keep using the website normally for users.
Is there any related or known issues or problem by running both ? I don't want the website to get frozen or act weird wit this.
Install codeigniter in it's own folder in a subdirectory instead of in the web root directory.
You will have to modify your config:
Installing a CodeIgniter application in a subfolder
Create a New Folder for your CodeIgniter Learning and Upload all CI files there including System folder and other.
If you Upload the the files with current website files folder it may create some issue.

How to move my htdocs folder to dropbox and call from there and use that folder for 2 systems?

How to move my htdocs folder to dropbox and call from there?
Me and my friend are on remote location and many times we work on same php projects.
We are on Windows and we use XAMPP for PHP development.
At both systems XAMPP is installed on C:/xamppp/
Is it possible to only move htdocs folder to my dropbox folder and use it from there. Then I can share that folder with my friends so he can also use the same htdocs folder in his PC to develop and test.?
In both cases you probably only need to set the paths correctly in each of your Apache configurations.
For example, just create your 'shared_htdocs' folder in Dropbox, share that with your friend, then in your Apache configuration in XAMPP where you have the site (vhost?) defined you need to point to that 'shared_htdocs' folder within Dropbox.
As long as all the code inside is relative and doesn't even need full pathing you should be good.

How to organize the htdocs folder when a wordpress installation is present?

I've been told by many tutorials (including the official wordpress tutorials) that I need to place all the files (in the wordpress folder) into the htdocs folder (without a sub-directory).
I'm using MAMP for my PHP environment and Dreamweaver CS5 to build the websites. The problem that I am having is that I want to create a new project in Dreamweaver that is not using wordpress, but because all those wordpress files are in the htdocs without a sub-directory, it is giving me all sorts of warnings that issues could occur if I place a directory for my new project in the htdocs folder along side all those other files.
I've tried putting all the wordpress files into a folder called "wordpress" under htdocs, but that breaks it and I've been told not to do that but not why I shouldn't do that.
How can I organize my htdocs folder so I can have more than one project present in that directory?
I would appreciate any help on this.
Thanks!
In local machine, you can be well sure of yourself that you need to organize each project of yours in a folder in the "htdocs" directory. This is of utmost importance to keep all the projects nicely so that you can later on reference all your projects easily.
When "tutorials are saying that you need to place all the files (in the WordPress folder) into the htdocs folder (without a sub-directory)", they mostly mean about the live server & not about the development server.
Also please check the ".htaccess" file of the root directory of each project, for the "Site URL" or the "Rewrite Base", when you are configuring multiple projects in the "htdocs" folder, so that each of the projects run smoothly. And you should also check that each project is running smoothly, which have been kept in the "htdocs" folder.
Hope it helps.

Categories