Error on Zend controller creation - php

I'm attempting to build a test project with the Zend framework and using MAMP to run it on my local host.
The project creation works fine; I navigate to my htdocs directory and use zf create project my_zend to create the scaffold.
My error comes when I try to create a controller "students" by using the following command zf create controller students, however, once this command runs it outputs the following error:
Context by name servicesDirectory does not exist in the registry.
Where does this error come from?

I had the same problem, here is how I fixed it, check for the line:
<servicesDirectory enabled="false"/>
In the .zfproject.xml file and remove it.

You might get this error if you have another version of zend some where in the path. If you have one try deleting it and using the latest or the version you wish to. This worked for me in xamp on windows 7 hope it works for you

Related

PHPStorm and CodeIgniter routing issue

I started studying CodeIgniter Web Framework and I am trying to work with PHPStorm 8.0.3 on Kubuntu 14.04. When I unzip CodeIgniter downloaded archive to root Apache folder /var/www/html and go to
localhost/index.php
then it works okay and I see "Welcome to CodeIgniter!" page. Also I
can use
localhost/index.php/welcome/index
and see the same page as it should be.
When I created a new PHP project in PHPStorm and try
localhost:63342/codeignitor/index.php/
then I see welcome page, but if I use
localhost:63342/codeignitor/index.php/welcome/index
then I get 404 page. Also all my own controllers are not available and
cause 404.
I can call my own controller only if I make it default
$route['default_controller'] = 'mycontroller';
I think that this problem occurs because the URL contains name of my project /codeignitor/, but I'm not sure about it. So I need your advice how to set CodeIgniter environment in PHPStorm correctly to solve this problem. Thank you!
Codeigniter uses the URL to determine routing, therefore /codeigniter/index.php/welcome/index and /index.php/welcome/index are not equal paths. I would recommend using one or the other, and adjusting your /index.php and /config/routes.php to accommodate for your desired path.
References:
Codeigniter Subfolder
https://www.codeigniter.com/user_guide/general/urls.html
https://www.codeigniter.com/user_guide/general/routing.html
https://www.codeigniter.com/user_guide/general/environments.html

How to create a migration in YII?

I have just started with YII and I am trying to create a new migration. I am using Xampp and it is located in the d drive of my system.
The command that I am trying to use is:
D:\xampp\php> d:\xampp\htdocs\yii\framework\yiic migrate create create_project_table
When I run the above command nothing happens, neither do I get an error message nor there is any error.
I did manage to successfully create a shell by using
D:\xampp\php> d:\xampp\htdocs\yii\framework\yiic shell d:\xampp\htdocs\trackstar\index.php
I tried to search for any solution for the migration issue but they all seem to be linux based. Please let me know what I am missing here. Thanks for your help.
I managed to create the migration sucessfully. Turns out that I needed to use the yiic located in the protected folder of my application instead of the yiic located in framework folder of yii. The command that I used is
D:\xampp\php>D:\xampp\htdocs\trackstar\protected\yiic migrate create create_project_table
I have found that you need a forward slash in my version.
yii migrate/create <migration_name>
First you need to go to protect folder on your Yii project
Then run the comamnd:
php yiic migrate create create_new_table_name_table

A project profile was not found error in zend framework

I am new to zend framework. I installed it and created a project using zf create project. Now I am not able to add action using zf create action add Index since am getting an error message 'A project profile was not found' can someone please help? http://www.leoganda.net/solving-zend-framework-error-an-error-has-occurred-a-project-profile-was-not-found/ the steps mentioned in this link is also not working
I use this tutorial and was able to setup ZF
http://akrabat.com/zend-framework-tutorial/
Change you dir to project dir.
On Windows:
cd disk:\path\project
zf create action
On Linux/Mac OS (you must has zf.sh in you PATH variable!):
cd /path/project
zf create action
If this don't help:
Did you copy library/Zend to you project?
i created an alias
alias zf='/path/to/zendframework/bin/zf.sh'
and now it work perfectly from the root of the project

zend framework : "A project profile was not found" zf version 1.11.7

I am trying to develop a project in zend framework. I have created a project gil using command line as follows then I entered to the project directory in command line and tried to create an action but I got an error as follows. I am using Windows XP and XAMPP and my Zend frameworks version is 1.11.7.
C:\xampp\htdocs\zframework12>zf create project gil
Creating project at C:/xampp/htdocs/zframework12/gil
C:\xampp\htdocs\zframework12>cd gil
C:\xampp\htdocs\zframework12\gil>zf create action add index
An Error Has Occurred
A project profile was not found.
Zend Framework Command Line Console Tool v1.9.0
Details for action "Create" and provider "Action"
Action
zf create action name controller-name[=index] view-included[=1] module
C:\xampp\htdocs\zframework12\gil>
Please help to sort out this issue
Thank you very much
In the second prompt, you type: cd gil . So, you'll move in the gil directory. This directory doesn't contain the zf xml file called .zfproject.xml (hidden). You should type:
zf create action add index
In the root directory: C:\xampp\htdocs\zframework12
I have the same problem, which caused by moving from one folders into another that lead to missing deleting hiden file .zfproject.xml. The solution is creating a new project "create project newname" and move all former files into this one.
Had the same problem with zf 1.12.9.
In my case, i was trying to execute command
zf1 enable layout from the parent dir to the project.
The solution was to go to the correct directory and then execute command.
This link helped me with my problem
original solution source
copy your zf.bat file to your new project 'gil' directory

Zend Framework create project error

I am new to the Zend Framework. I read the Zend Framework document. Here I saw to work Zend Framework must include the path in my php.ini, I believe that this is done because in my php info I saw include path is C:\www\zend_frame\library
Also in document it says that to create a project I must run:
C:\> zf.bat create project quickstart
I want to create a project in C:\wamp\www
In my command shell I ran:
C:\>wamp\www> zf.bat create project quickstart
But I got an error message (see below).
Then I tried another way:
C:\>wamp\www> C:\wamp\zend_frame\bin\zf.bat create project quickstart
Here I got the same error:
Php.exe is not recognised as an internal or external command, operable program or batch file
I also set the path in My Computer settings
The Zend Framework zf.bat script assumes that it can run "php.exe" without specifying the full path to that executable, and it will be found because you have set your PATH to include that directory:
SET PATH=%PATH%;C:\wamp\bin\php
Depending on the version of WAMP, the php.exe may be in a subdirectory for the version of PHP. In that case you need to use a command something similar to this:
SET PATH=%PATH%;C:\wamp\bin\php\php5.3.0
You should be able to figure it out from here.

Categories