Zend Project not working in a real server after upload - zend-framework

I just completed the job site using zend framework. This is my first project using Zend framework. The site is almost finished in localhost and i tried to upload it in real server for testing. I put my files under public_html folder of real server. I noticed there is no any file "index.php" inside root folder of project(ie public_html). It actually lies inside public folder inside public_html. I am bewildered. I tried to make index.php inside root folder and put "require_once('public/index.php'), but didn't work. What should i do now?
Thanks.

Assuming a typical project directory structure, your public folder should go inside your server's public_html folder, and all other Zend project folders should go one level up, like this:
/application
// application files
/library
// library and vendor files
/public (aka public_html, htdocs etc)
index.php
.htaccess
/css
/images
/js

If you can, configure a vhost on your server, and make it point to the "public" folder of your application.
You should also enable the rewrite module of apache and ensure that your vhost accepts .htaccess files (directive AllowOverride All in your vhost).

The way I do it, is to have the index.php and .htacess 1 level up from the public directory and alter the paths defined in index.php accordingly.
e.g
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));

Related

How to find the Entry Point in the Magento project version 1.9.3.1

I am unable to find the entry point in the project where my index.php is located in the project, please help me on this.
Index.php file always exists in root of your Magento.
In magento 1.9.3.1 or any version of magento index.php is found in your root folder without index.php magento not run you can find publichtml or var/www/projectname/ if your in localhost xampp htdocs/project name or wamp www/your project name.

How to include public_html sibling folder in a PhpStorm project?

I have the following site directory structure (on a shared hosting):
/home/username/
public_html/
index.html
resources/
config.php
I am trying to set up a new project using the remote deployment in PhpStorm. I'd like to have both public_html and resources folders accessible, since both contain PHP files. I am confused by what should be the Project Root. Logic suggests that my project root is the top level directory containing all my files, i.e. /home/username/.
However if I mark it such in PhpStorm, the next screen (Specify Web Path) automatically maps my web root folder to the project root.
As the result, if I run /home/username/public_html/index.html from PhpStorm, it tries browsing to https://webroot/public_html/index.html. This is wrong. The web root should be mapped to /home/username/public_html. Actually, the very question ("Web path for project root '/home/username'") is invalid, since there is no web path to folders above public_html, that's the whole point of putting resources there. How should I properly configure folders in PhpStorm?
Such setup is definitely possible -- its very common to have website root folder as a sub-folder of the actual project.
As far as I'm aware it is not possible to create such setup right from New Project Wizard -- it has to be done at later stage when project creation was completed.
You need to go into Settings/Preferences | Build, Execution, Deployment | Deployment and add new mapping. Here is an example:
Here my website root is located in web folder -- you will have to change that to yours public_html. This way when you use Open in Browser on file inside your web root folder it will be opened with correct URL.

Sails js 9.4 - assets not being copied

First sails didn't create .tmp/public, so i did it manually. But it also doesn't copy stuff from my assets folder to my public folder. Can someone explain why that is?
#
At that time, the answers i got weren't helping,
I've updated to 9.8 now, and i don't seem to have any problem.
#
I had this same issue. When running sails lift the .tmp folder wasn't created. What finally worked for me was installing Grunt locally in the root folder of my sails app. So just run npm install grunt in your sails app folder. Having Grunt installed globally with the -g flag was apparently not enough. After the local installation, you can run sails lift again, and the .tmp folder will be created.
Hope this helps!
Where do I put my css and javascript assets in sails?
Sails uses grunt to manage assets. Some of this "management" involves syncing files between your project folder structure and the server's public folder, but as always, I'm getting ahead of myself.
The configuration of grunt is based upon the Gruntfile.js file found in the root of your sails project. There’s a lot going on in this file, however, I’m going to concentrate on the javascript and css assets.
Your Project's Assets
When you first create a project, you have the option of using the --linker flag. An example of using the flag would be sails new projectName --linker. Here’s the directory structure of the /assets folder under both scenarios:
USING the --linker flag
/assets
/images
/linker
/js
/styles
/templates
NOT USING the --linker flag
/assets
/images
/js
/styles
Note, you can “upgrade” a project that wasn't created with the --linker flag by manually creating the /linker folder and inserting it into your /assets path. You can then add /js, /styles, and /templates under /linker.
The Server's Public Folder
When starting the sails server via sails lift the following folder structure is created/sync'd via grunt within the .tmp folder:
.tmp
/public
If any of the other project folders (e.g. /images, /js, /styles, /templates) contain content they are copied/sync'd to the .tmp/publicfolder. The distinction being that if a /linker folder exists, the /js, /styles, and an additional /templates folder is created under /linker.
What happens to my layout.ejs file?
If you use the /linker folder, sails will alter your layout.ejs file to include links to your javascript and css files. Therefore, any page served from the project's /views folder will have access to the javascript and css contained in these files.
Grunt uses commented tags in layout.ejs to as placehodler for these links. For example, anything placed in the /style folder will automatically be linked in layout.ejs between these two tags:
<!--STYLES-->
<!--STYLES END-->
Anything in the /js folder will be linked between these two tags:
<!--SCRIPTS-->
<!--SCRIPTS END-->
Anyting in the /templates folder will be linked between these two tags:
<!--TEMPLATES-->
<!--TEMPLATES END-->
Accessing Sail's Assets
Here's how you access the assets under either scenario:
USING the /linker folder
/js --> /linker/js/yourFile.js
/styles --> /linker/styles/yourCSS.css
NOT USING the /linker folder
/js --> /js/yourFile.js
/styles --> /styles/yourCSS.css
It didn't appear that Grunt was doing anything on my installation including copying the assets folder. I found this post on the Google Group by Rob Wormald that finally got it working for me:
In your .sailsrc file, in the root of your project, remove the line that says "grunt" : false. That should get things working.
This was an issue with one of the generators that I believe should be corrected in the next release.
You will need to check Gruntfile.js in your sails project root directory and everything will be much easier to understand. Here is some short explanation:
Sails 'magic' during lift process are hidden in Grunt tasks.
If Sails not create .tmp/public directories in your project, it can be because permissions or something similar (its happen on Windows as I know, I not have it on Linux). Solution is to create manually .tmp/public directories and to be sure that is writable.
To get your assets copied to .tmp/public you will need to keep it inside assets/linker directory, or to update Gruntfile.js based on your specific need.
I hope this help :).

How to get a welcome page from Tomcat root, rather than webapp context?

In Tomcat 7, I want my welcome page (index.html) to load when I access localhost:8080/. Right now, I have to go to the webapp context, localhost:8080/MyWebApp.
Is there a folder in Tomcat to place pages that are not part of a webapp? I'm confused how this works...
EDIT: I notice that the web.xml for the Server in Eclipse has a servlet called "default" which is mapped to "/"... I wonder if I have to change something here?
EDIT2: I found this: http://wiki.apache.org/tomcat/HowTo#How_do_I_override_the_default_home_page_loaded_by_Tomcat.3F
But, I already have an index.html in my ROOT folder, and still getting 404 from the root URL. If I start the server without using Eclipse, it works. What's going on here? What exactly does Eclipse do when you start the server through it? Obviously it's not reproducing the ROOT folder of my installation.
You are missing ROOT folder from 'webapps' - maybe it was deleted during installation of the other app. ROOT folder has config files for 'Welcome' page for tomcat. You can copy it from the other tar file into ../webapps folder and you'll be good.
In Apache Tomcat, all websites are deployed as individual web applications. You can verify this with the Tomcat configuration manager, where you are able to start/stop/reload certain web applications.
I believe you would like to place the welcome page in path tomcat/webapps/index.html - all files located here not in a webapp of subfolders should be viewable as the root of the url.
It's only anything above webapps in tomcat that's protected from web browsing. maybe you can try putting the file in index.html, and setup a link preceded by ../ to indicate "go a directory level above in the tree" to fetch this required file, or try listing the directory of the url root to see in which context you're in actually.
Hope this helps clarify something at least.
Solved!
http://wiki.eclipse.org/WTP_Tomcat_FAQ#If_I_start_my_Tomcat_server_and_try_to_display_Tomcat.27s_default_page.2C_why_do_I_see_a_directory_listing_or_404_error_page.3F

Zend framework on mac OSX: can I change the root Directory?

Zend framework on mac OSX: can I change the root Directory ?
how ?
I would like to set a directory in my home folder.
Otherwise I can only access to it by terminal
thanks
Which root directory are you talking about? The location of the ZF libraries, or your application's root?
Either way, you can put things wherever you'd like.
For the ZF library itself, just stick it anywhere, and make sure ZendFramework-x.y.z/library is in PHP's include_path
For your application, it's just a matter of setting the DocumentRoot in your apache configuration to the public/ directory in your project.