Zend framework deployment - zend-framework

Hello
I wanted to upload my web project done with zend framework on my ftp server.
I have uploaded it to the public_html/projects/myproject directory (I uploaded whole folder structure, directories: application, docs, library, Obsolete, public, scripts, tests, Zend).
Now if I type www.mydomain.com/projects/myproject I see all these folders.
If I want to run project I have to type www.mydomain.com/projects/myproject/public
I am not really surprised with that because it's exactly what I could expect, but I don't know how to make all folders other than public inaccessible and I would like to run my project after www.mydomain.com/projects/myproject...
What should I do to achieve this goal?
Greetings!

You will have to put htaccess files in the root, projects and myproject directories to disallow access. I don't know it by hand but it should be
deny all
Then in your apache config, might be a file named sites-enabled, there you should only need to add the directory config to the default host, e.g.:
<virtualhost foobar:80>
some crap here
some more crap
<Directory /projects/myproject/public>
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</virtualhost>
That should make your site work.
Remember to add the following to your project's htaccess file:
RewriteBase /projects/myproject
Hope that helps.

Related

Can PhpStorm transform .htaccess files on deploy?

I am currently developing a PHP application using JetBrains PhpStorm. This applications contains several .htaccess files.
As there is right now no automated deployment process for this application I am using the "Upload to..." feature in PhpStorm. Using this feature the application is deployed to several servers.
The .htaccess files in my application need to have different content on different servers (staging systems vs production etc.). Unfortunately, so far I have not found a way to manage this reliably and have repeatedly overwritten .htaccess files with versions which are not suitable for the server I am deploying to.
Is there a way to make PhpStorm transform my .htaccess file before it is deployed? Or could I maybe define different versions of the same file for different servers?
The .htaccess files on each server are symlinks to the specified htaccess file in a folder. In this folder you have all your htaccess files from all servers. You skip the upload of the .htaccess files in PhpStorm, but you can change and deploy the files in the htaccess folder.
If you are able to create symlinks for htaccess files on your server, then this solution should work. It's not a clean solution, but better then wrong htaccess files on a server.

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 treat index.cgi as a directory index in Eclipse EPIC Perl CGI?

I am using the Eclipse EPIC (Perl Editor and IDE for Eclipse) Plugin's "Perl CGI" debug and run configuration on a site that uses index.cgi as it's directory index file. The site was written expecting the Apache DirectoryIndex to be index.html index.cgi, so most links just point to the directory and not to index.cgi. This results in getting 404 responses if index.html does not exist instead of displaying the results of index.cgi.
Is there a setting to make EPIC Perl CGI emulate the behavior of Apache's DirectoryIndex index.html index.cgi so that it serves index.cgi instead of 404 when it is available?
So far I have found no setting to configure this. The content seems to be served by a java process started by Eclipse. For now I'm scattering index.html files around with meta refresh tags.
<meta http-equiv="refresh" content="0;URL='index.cgi'" />

Zend Project not working in a real server after upload

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(),
)));

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.