ZF2 routing does not work on IBM i

General discussion on Zend Server for IBM System i
Post Reply
gfroehlich
Posts: 24
Joined: Tue Jul 06, 2010 11:48 am

ZF2 routing does not work on IBM i

Post by gfroehlich » Mon Apr 14, 2014 11:31 am

On fresh installation of ZendServer 6.3 with php 5.4 (OS Version V6R1) I've tried to run the mobile test project. At the point testing the RPC services there was not resoult at all. The same application deployed to my localhost on Win8 works as expected.

To see what happens on IBM i, I've turned the rewrite log on:

Code: Select all

192.168.x.x - - [14/Apr/2014:10:35:17 +0200] [ibmi.mycompany.lokal/sid#80000024f3d0][rid#8000000d44b0/initial] (3) [perdir /usr/local/zendsvr6/var/apps/http/__default__/0/MyMobApp/1.0.0_1/public/] add per-dir prefix: index.php -> /usr/local/zendsvr6/var/apps/http/__default__/0/MyMobApp/1.0.0_1/public/index.php
The index.php exists on the place from logfile. Because the debugger does not work on this system, I putted an echo on the first line of it followed by an exit (1).

A request to http://ibmi.mycompany.lokal:10080/MyMobApp returns the content of my echo statement, but a request to http://ibmi.mycompany.lokal:10080/MyMobApp/customers or anything else after the application reurns an empty page without any error somewhere: apache log, php log

This is the entry of access log:

Code: Select all

192.168.x.x - - [14/Apr/2014:11:59:16 +0200] "GET /MyMobApp/customers HTTP/1.1" 200 - "-" "Mozilla/4.0 (compatible; MSIE
8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
HTTP code 200 means OK, the dash behind is the place for the lenght, this means to me no error with zero length response.

Where got the request lost? What is the real endpoint? If it would be index.php of MyMobApp, my expectation is the content of the echo statement.

Has anybody an idea what happens or some hints what else I can do for better logging?

Thanks for any help
Gabriel

gfroehlich
Posts: 24
Joined: Tue Jul 06, 2010 11:48 am

Re: ZF2 routing does not work on IBM i

Post by gfroehlich » Wed Apr 16, 2014 12:27 pm

I found the following post on the net:
https://www.openshift.com/kb/kb-e1073-g ... pplication

With index.php in url it is wotking (http://ibmi.mycompany.lokal:10080/MyMob ... /customers), so I've checked my .htaccess and it looks similar to the one from the post:

Code: Select all

RewriteEngine On
### Uncomment lines below to enable forwarding of 'Authorize' header for Apache in 'Server API CGI/FastCGI' mode
#RewriteCond %{HTTP:Authorization} ^(.*)
#RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
Without index.php in the url it's still not working. Does anybody knows, what's wrong with the rewrite rules?

thanks
Gabriel

gfroehlich
Posts: 24
Joined: Tue Jul 06, 2010 11:48 am

Re: ZF2 routing does not work on IBM i

Post by gfroehlich » Wed Apr 23, 2014 11:01 am

found a solution in this forum under 'Known Issues':
http://forums.zend.com/viewtopic.php?f= ... 33#p209383
* Cloud Connected Mobile project on IBM i:
Due to a limitation in the rewrite module of the IBM i Apache, rewrite rules that enables pretty URLs will not work out of the box.
For example, instead of using
http://server.address/appname/getCustomers
one would have to use
http://server.address/appname/index.php/getCustomers.
Workaround:
Manually enable pretty URLs by adding a RewriteBase statement to the .htaccess file, right below RewriteEngine On:
For example for the case above:
RewriteEngine On
RewriteBase /appname
Gabriel

P.S: When I'm online there are only Google and Bing bots online. Am I in the wrong time zone?

Post Reply