Zend studio/- framework not installed properly? - php

(mind you: I'm a complete noob regarding zend framework. I've been using CodeIgniter and Zend Studio for quite some time now but felt the need to "expand", so to say.)
Using the Studios built in ZF generator I made myself a fresh ZF 1.11 install on my localhost. However, when I tried to access my newly made index page, I cannot see a thing. I fear that Studio has not installed the proper files for my Framework appilcation, seeing that the require_once 'Zend/Application.php'; line requires it to load a non-existing file.
Could anyone give a hand perhaps?
Thanks!

Zend library path is not correctly configured in php.ini file.
Configure the above stated file and also put the zf.bat or zf.sh according to your working platform in the path directory of the system.
Then, configure your httpd.conf file and configure the virtual host as follows (On linux Platform).
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerAdmin root#server.om.com
DocumentRoot /var/www/html
ServerName www.om.com
<Directory "/var/www/html">
AllowOverride All
</Directory>
</VirtualHost>
Along with that
mod_rewrite should be enabled in your httpd.conf file of Apache.

Can you give some more details about your installation. I use Zend all day but I dont use Zend Studio zf generator, so I dont know how it has set you up.
What OS are you running and whats your apache server setup? (Zend Community Server, wamp, mamp)
Have you setup added your domain name to the host file? 127.0.0.1 dev.mydomain
Is your VHOST pointing to the public directory?
Do you have an .htaccess file inside your public folder.
I am thinking at the very least if it is set up correctly you should see the blue and green Zend Framework output in your Index Controller view Script.

Make sure that the paths are correct in /public/index.php.
Its quite possible your zend library is not in /library and thus you must ajust your paths accordingly.

Download ZF from its website and copy the folder "Zend" inside your application library folder and then check again . Also open index.php inside your public folder and paste this code on top
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));

Related

How do you configure Symfony 4 to route alongside other XAMPP (Apache) projects?

I'm brand new to Symfony, so this question will undoubtedly come across as noobish. How do you get Symfony to work with XAMPP? I've read the Symfony documentation for configuring Apache, but can't make heads or tails of it.
XAMPP projects are stored in a single /htdocs directory. Each project has its own subfolder and is accessible via the following URL: http://localhost/project_folder. At least, that's how I've been doing it.
My problem is this: Symfony is different in that its root directory is not front-facing. In other words, to actually access a Symfony 4 site, you need to navigate to the /public directory. However, as my local XAMPP (i.e. Apache) server is configured to use a single DocumentRoot (/xampp/htdocs), my Symfony project is inaccessible unless I manually append /public to the URL.
What I want: http://localhost/symfony_project_folder
What I have: http://localhost/symfony_project_folder/public
I do not want to set up an entirely separate local server for a single web application, nor do I want to deal with an entirely different URL structure than what is used by my other projects.
How do I configure Symfony 4 or Apache to properly route to /public in this environment?
Thank you for your help.
Hi there indeed when you create a new symfony project you need to change the document root of the domain in public folder. A good way to work with symfony would be to use docker which helps you out keep projects separated and you can use phpdocker.io to generate a docker configuration very fast to start working with docker.
Anyway here is an example from symfony manual on how to setup a vhost.
<VirtualHost *:80>
ServerName domain.tld
ServerAlias www.domain.tld
DocumentRoot /var/www/project/public
<Directory /var/www/project/public>
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
# <Directory /var/www/project>
# Options FollowSymlinks
# </Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>
You can read more about web server configuration here

Zend2 without Virtual Host

I have Zend2 website configured on an Ubuntu machine.
Project Path: /var/www/zf2/
Virtual host configuration:
<VirtualHost *:80>
ServerName zf2.localhost
DocumentRoot /var/www/html/zf2/public
SetENV APPLICATION_ENV "development"
<Directory /var/www/html/zf2/public/>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Accessing "localhost/zf2" list the files in the directory. Is there anyway to access this zend2 website without virtual host i.e with localhost/zf2 ?
I already tried by adding .htacess in /var/www/html/zf2, but it does not budge. Any help will be highly appreciated!
The question isn't very clear, but if you're asking if it's possible for someone to access your ZF site without using the zf2.localhost hostname, then because of the way you have set it up, yes (and you should definitely change this).
By default, Apache on Ubuntu has localhost setup to point at /var/www/html/. So by putting your ZF2 app in a subfolder of that, it will be possible for someone to access your ZF app (including files outside of its document root) via. localhost. This is a potential security hole which you should fix. Simply move your ZF2 app to a different folder that isn't inside /var/www/html (e.g. /var/www/zf2) and you won't have this issue.
Also note that if you are using a reasonably recent version of Ubuntu, you will be running Apache 2.4, and your vhost isn't setup correctly. See the second example here: http://framework.zend.com/manual/current/en/ref/installation.html#apache-setup

Netbeans and Zend-Framework

I have just started using the Zend-Framework. On advice of a friend I use NetBeans for PHP development with Zend. I have installed NetBeans and referenced the Zend-Framework under Tools>Options>PHP>Zend, registered it since I am using a version newer then 1.10.
Under PHP>General I have inluded the Zend-library path as a Global-Include-Path.
Since I've read that the beginners tutorial provided on the website (http://framework.zend.com/manual/en/learning.quickstart.create-project.html) has some errors and since it does not use NetBeans I started with this video tutorial: http://netbeans.org/kb/docs/php/zend-framework-screencast.html
Creating the project as a Zend-Framework Project worked just fine, all default folders and files are created. However, when I run the project with this defauilt setup the browser should diplay the index.php provided by the Framework under localhost/quickstart, instead of that it just displays a listing of the files of directories:
Index of /quickstart
Parent Directory
.zfproject.xml
application/
docs/
library/
nbproject/
public/
tests/
I suppose there is something wrong with the configuration of the apache server but the video screencast did not mention any needed configuration when using netbeans.
I am using xampp and one of the things that might be the problem is the httpd.conf file as described in the tutorial (http://framework.zend.com/manual/en/learning.quickstart.create-project.html) since no NameVirtualHost-propperty is defined there and no VirtualHost configured. However I didn't want to change the httpd.conf without knowing if that is the problem.
Also adding a line "127.0.0.1 quickstart.local" to the hosts file turned out to be impossible under Windows 7, so in case this is actually neccesary, I would apreciate any help.
Thanks,
Lukas
Have you set the DocumentRoot in the apache httpd-vhost.conf to the public folder?
All you should need to do is add public to the end of your current document root...
Also to change the vhosts file in windows 7 you need to find notepad in the start menu -> all programs -> accessories
Right click and run as Administrator
File -> open -> C:\Windows\System32\drivers\etc\hosts
Now add your records and save.
Opening as Administrator allows the save to attually save the changes.
Ironically, I just went through all of this yesterday. First, what happens when you type: localhost/quickstart/public, into your browser instead of: localhost/quickstart ? The controller is accessed via the index action and .htaccess file inside that directory.
Second, in regards to editing the hosts file... I have windows 7 as well, and all i did to find it was type "system32" in the Search Programs and files, then follow the path to the hosts file. I was able to edit it using notepad and it worked great!
there are two steps to configuring the vhost after that. You will need to uncomment a line in the httpd.conf file under the apache folder, remove the # from httpd.conf:
#Include conf/extra/httpd-vhosts.conf
Then go to the extras folder and add the following to the bottom of your httpd-vhosts.conf file like so:
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.localhost
DocumentRoot "C:/path_to_local_webroot/quickstart.com/public"
ServerName quickstart.com
ServerAlias quickstart.com
ErrorLog "logs/quickstart.com-error.log"
CustomLog "logs/quickstart.com-access.log" common
</VirtualHost>
For your hosts file, just add one line to the bottom:
127.0.0.1 quickstart.com
Then restart your server and you should be good to go.

Creating website using Zend Framework

I have installed zend server on my local system.I created one project folder using this command line argument
zf create project quickstart
The project folder is created on C:\Program Files\Zend.
How i can run the project in browser.
http://localhost/zend/
I suggest not to use a subfolder or you'll have problems with URLs. Create a virtual host on you local apache ! it's by far the best solution !
look here
http://akrabat.com/zend-framework-tutorial/
download the PDF, at the end of page 3 there is the guide to configure the virtualhost
Briefly,
add this to apache conf file
<VirtualHost *:80>
ServerName zf-tutorial.localhost
DocumentRoot /var/www/html/zf-tutorial/public
<Directory "/var/www/html/zf-tutorial/public">
AllowOverride All
</Directory>
</VirtualHost>
where
/var/www/html/zf-tutorial/public
is the path to the index.php (inside public folder of the zend project)
If you are using windows, use c:/www/etc...
then edit hosts file (linux: /etc/hosts)
and add the line
127.1.0.1 zf-tutorial
restart apache and point the browser to
http://zf-tutorial
if you create a simple zend framework with zend studio (it creates all necessary files).
put it in your server folder (htdocs) und run it with localhost/project/public/index.php
You don't need the zend server to build/run zend Projects.
Just Download mix or max Zend Framework package and you can start.

Setting up path mapping in PHP and Eclipse

I have just setup my website locally so I can test my pages more easily.
Eclipse has been configured to use an XAMPP server locally.
The problem is that I want to map my project to a certain place in my website.
ie. In my Eclipse PHP project I have a folder called
com
I want this to map to
/com
in the webstie.
I tried to do this in the mapping section of the Eclipse server setup but it didn't work. When I type
http://localhost/com/
It should go to my project folder, however, when I type other folder it should use the normal website folders.
how can I do this?
Well I edited the apache httpd.conf file like this and it works.
#Alias for com folder
Alias /com C:\PHP\workspace-php\php_project\com
<Directory "C:\PHP\workspace-php\php_project\com">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I'd created my Eclipse workspace exactly on [xampp]\htdocs folder

Categories