apprentice (77) [Avatar] Offline
#1
<h3>What does this error mean? </h3>
I'm trying to follow this tutorial v.1.6.2 by punching in the instructions.
http://akrabat.com/zend-framework-tutorial/
Previously I just extracted the finished example source codes and set things up to see if it works. It did! But now when I try to do it from scratch myself I get stuck at chapter "Listing albums"

I compare the files and codes between my working vhost with my learning vhost, but I can't seem to find the difference.
If I learn to understand this Error message then maybe I might find the problem?


[pre]
My Albums
An error occurred
message ?>
Exception information:

Message: exception->getMessage() ?>
Stack trace:

exception->getTraceAsString() ?>


Request Parameters:

array(3) {
["controller"]=>
string(5) "index"
["action"]=>
string(5) "index"
["module"]=>
string(7) "default"
}
[/pre]
akrabat (479) [Avatar] Offline
#2
Re: Request Parameters: ERROR page?
short open tags are not enabled?

Rob...
apprentice (77) [Avatar] Offline
#3
Re: Request Parameters: ERROR page?
<h3>1.) The problem</h3>
I found the problem somehow my webapplications that I'm trying to build suddenly starts to connect to a different database. What could have caused this?

application.ini
http://pastebin.com/m10a402f6





<h3>2.) How I found the problem</h3>
Before I posted my problem here I googled the Error message and found out it was a short open tags issue.
http://forums.zend.com/viewtopic.php?f=69&t=998

But since Harry Fuecks who wrote the books "The PHP Anthology OOP Solutions - Sitepoint" advised against using short open tags. Because it doesn't make your code portable, because you can't always control the php.ini file on any given webhost.

I decided to not touch php.ini and enable the short open tag. Instead I went into this file and replaced all <?= with <?php: <br />
application/views/scripts/error.pthml





<h3>2.1.) The Danger with doing things with <?php</h3>
Is that the Error message you recieve doesn't give you any hints at all.
While using <?= with short open tags enabled in the php.ini file gives you a lot of Error information. Why does it differ so much? I prefer to use <?php like Harry Fuecks advocated in his old (latest updated 2004) OOP books smilie <br />
... I have to correct myself here There's no Danger with using <?php the Error messages is the same as when you use <?= the thing is that you have to do <?php echo in relevant places which I missed on my first try. <br />





<h3>1.) Back to The problem</h3>
Anyhow back to the problem when I tried to do things with short open tags enabled. The Error message told me that it was trying to connect to tutorial_dev which didn't exist instead of my main tutorial database.

application.ini
http://pastebin.com/m10a402f6

[pre]resources.db.params.dbname = "tutorial_dev"[/pre]

Somehow my webapplications that I'm trying to build suddenly starts to connect to a different database. What could have caused this? See my problem now?



.
akrabat (479) [Avatar] Offline
#4
Re: Request Parameters: ERROR page?
You should change [pre]<?=[/pre] to [pre]<?php echo [/pre] <br />
The echo is important.

Regards,

Rob...
apprentice (77) [Avatar] Offline
#5
Re: Request Parameters: ERROR page?
.


So any ideas why my application is connecting to a different database that I didn't tell it to use? Is there some specific file from this Album tutorial that I can show you that might shed some light on this weird problem?


<h3>1.) Back to The problem</h3>
Anyhow back to the problem when I tried to do things with short open tags enabled. The Error message told me that it was trying to connect to tutorial_dev which didn't exist instead of my main tutorial database.

application.ini
http://pastebin.com/m10a402f6

[pre]resources.db.params.dbname = "tutorial_dev"[/pre]

Somehow my webapplications that I'm trying to build suddenly starts to connect to a different database. What could have caused this? See my problem now?


.
akrabat (479) [Avatar] Offline
#6
Re: Request Parameters: ERROR page?
You are loading the "development" section of your config file.

This is controlled by the .htaccess file at a guess


Regards,

Rob...
apprentice (77) [Avatar] Offline
#7
Re: Request Parameters: ERROR page?
Thanks Rob you're right on the money again it was .htaccess causing all this weird behavior.
Now I understand why the whole ZF experience felt weird when I try to build things from scratch. ZF tool creates that one extra line in .htaccess that's something new compared to how ZF used to do things.


[pre]
# SetEnv APPLICATION_ENV development


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