Jump to content

Help cannot get to page. create model and database table quickstart example


simpli

Recommended Posts

Hi all,

I have been doing the quickstart for Zend and I am at the 'create a model and database table' part. I figured all had gone relatively smoothly so far so instead of copy pasting the example I started to adapt it to suit my needs. I also have been reading tons of doc. But I'm still stuck. I have created controllers, models and views ( according to the intructions) when I try to connect to what I think should be the web page I get a 404 error. Exact error is

 

Not Found

The requested URL /budgetobjects/companyinfo/ was not found on this server.

 

When I look at my Apache log I see the following error:

File does not exist: /Library/WebServer/Documents/budgetobjects/companyinfo

and that's right my file is not there. My files are in the following directories:

Controller: /library/WebServer/documents/budgetobjects/application/controllers/CompanyInfoController.php

 

View: /library/WebServer/documents/budgetobjects/application/views/companyInfo/index.phtml

 

Model: /library/WebServer/documents/budgetobjects/application/models/companiesInformation.php

 

Model mapper: /library/WebServer/documents/budgetobjects/application/models/companiesInformationMapper.php

 

Can someone tell me what's wrong with my setup? and give me a hint how I can solve this?

I'm stuck.

Thanks

JR

 

Link to comment
Share on other sites

Have you setup your mod_rewrite rules? I just had a look and it seems its now missign from the quickstart.

 

You would need this....

 

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php

 

within a .htaccess file within your public directory.

Link to comment
Share on other sites

I definitely don't have that. Can you tell me what it's for and what it does? I will try to do the quickstart exactly like he does and see where that takes me. I thought it had to do with something missing in my configuration.

 

Thanks,

JR

Link to comment
Share on other sites

The snippet above configures apache to send all requests for files that don't exist (or end in the mentioned file extensions) to your index.php file. Without it Zend won't work. At least not the default http router anyway.

 

This is what enables urls like http://domain/controller/action to be handled by your application when there is clearly no such file.

Link to comment
Share on other sites

I am having no luck still with this issue. Here's the config on my files. ( I removed comments for space).

 

httpd.conf:

DocumentRoot "/Library/WebServer/Documents"


<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory "/Library/WebServer/Documents">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Options FollowSymLinks
    Order allow,deny
    Allow from all
    Options Indexes MultiViews
    AllowOverride AuthConfig	
</Directory>

<Directory "/Library/WebServer/Documents/budgetobjects">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

The important directory for me is /Library/WebServer/Documents/budgetobjects

in it I have an .htaccess file with the following:

SetEnv APPLICATION_ENV development

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
        

 

yet when i try to go to the location http://localhost/budgetobjects/CompanyInfo/ I get a 404 error : The requested URL /budgetobjects/CompanyInfo/ was not found on this server.

 

In my error log I see the following message: /Library/WebServer/Documents/budgetobjects/CompanyInfo.

 

Of course the file does not exist but isn't Zend supposed to translate this into the proper path to go to my index.php?

Thanks for any help.

JR

 

Link to comment
Share on other sites

Of course the file does not exist but isn't Zend supposed to translate this into the proper path to go to my index.php?

 

No. Apache needs to be configured to pass all requests to your index.php script, Zend takes over from there.

 

Looks to me like your trying to run a Zend framework application from within a subdirectory of your document root. You need to tell Zend about this.

 

See here.

Link to comment
Share on other sites

Isn't that the normal way to go? we have the webserver directory and one subdirectory for each project right? I followed the page but I have no idea how to implement what's there. Maybe it's too late. I'll see after a night's sleep if I get any further.

 

Thanks again,

JR

Link to comment
Share on other sites

Creating a virtual server has been my strategy as well but I dont think it was working. I didnt want to spend too much time fixing it though but I think it caught up to me. I think I need to start over. Imma start a new thread to fix my virtual server problem and maybe it'll solve my ZF problem as well.

JR

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.