Posted by mnshankar on October 29, 2008
Posted in News and politics | Leave a Comment »
Posted by mnshankar on October 27, 2008
On my work computer (development), I have Windows, Apache, Mysql, PHP setup to run Zend Framework. For the life of me I could not understand why my .htaccess file was failing to route requests properly, even though I followed all the instructions exactly (including setting AllowOverrides=All, ensuring mod_rewrite was loaded etc).
I was using an Alias block in my .httpd file to use a different virtual directory
Alias /myweb "C:\web\myweb\htdocs"
<Directory "C:\web\myweb\htdocs">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
The .htaccess file in my C:\web\myweb\htdocs folder was:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ – [NC,L]
RewriteRule ^.*$ index.php [NC,L]
All redirects were resulting in a 404 (Page Not Found) error. After lots of trial and error, I found out that the error was due to a missing RewriteBase directive!
The following htaccess file fixed the problem
RewriteEngine On
RewriteBase /myweb
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ – [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Posted in Zend Framework | Leave a Comment »
Posted by mnshankar on October 26, 2008
I just discovered that there is a setting in PHP.ini that makes web folder access rights in Vista/IIS7/PHP a breeze! Open php.ini and look for the setting fastcgi.impersonate. Set it to 1 (Uncomment it if the line already exists)
fastcgi.impersonate = 1;
Restart the web server.
This directive enables PHP applications on Windows to impersonate the authenticated user making the request enabling PHP scripts to execute as that user (and not as an IIS process).
Once this is done, you do not need to add the IIS_IUSRS group to every folder that you want IIS to access! Yeah!
Posted in Zend Framework | Tagged: fastcgi, impersonate | Leave a Comment »
Posted by mnshankar on October 26, 2008
While running your Zend Framework application, if you receive an error that looks like :
Zend_Session::start() – D:\Web\library\Zend\Session.php(Line:426): Error #8 session_start() [function.session-start]: ps_files_cleanup_dir: opendir(C:\Windows\TEMP\) failed: No such file or directory (2) Array
The solution is:
1. Edit your php.ini file and set your save_path variable to a physical folder on your computer
session.save_path = “D:\Web\session”
2. Remember to give the IIS_IUSRS builtin group R/W permission to the folder
3. Restart the webserver
Posted in Zend Framework | Tagged: PHP session, ps_files_cleanup_dir | Leave a Comment »
Posted by mnshankar on October 18, 2008
One of the best benefits of using Zend Studio for your Zend Framework project is getting the autocomplete feature. However, when you import an existing project (using ‘import’->’existing projects into workspace’, the feature does not get turned on.
Here’s how you can get it working:
1. Create a new PHP project
Give the project a name (and a new directory)
On hitting the Next button, you will be prompted for the PHP include path libraries. Select Framework_1_6
Now, a PHP project that is linked to the Zend Framework libraries is created..Right click on the folder and select ‘Import’
Select the ‘File System’ option
Navigate to the folder that contains the files and folders that you want. Check the entire root folder
Voila.. you now will now have autocomplete and tooltip help on all Zend framework components!

Posted in Zend Framework | Leave a Comment »
Posted by mnshankar on October 18, 2008
Often times you may need to grant the web server ’Write’ or ‘Modify’ access to folders (for logging, loading files, creating graphics etc). The way to do that is to grant the required permissions at the folder level to the GROUP that the default IIS user belongs to.
The default built in GROUP under which the IIS process runs (in IIS 7) is IIS_IUSRS.
Bring up the properties of the folder (right click+properties). Click on the ‘Security tab’:

If you do not have the IIS-IUSRS group in the ‘group or user names’ list, click on the ‘Edit’ button and then the ‘Add’ button. Type in iis_iusrs in the object name field and hit the “Check Names” button:

Then, make sure that the ‘Modify’ and ‘Write’ permissions for the IIS_IUSRS group is checked..Hit the ok button when done.

Posted in Computers and Internet | Tagged: IIS7, IIS_IUSRS, Write webserver | Leave a Comment »
Posted by mnshankar on October 12, 2008
This error (thrown by Zend Framework) indicates that your php.ini file is not yet ready for Zend_Db. The fix is easy:
- Open php.ini
- uncomment the line
extension=php_pdo.dll
- uncomment the line (depending on the database you are using)
extension=php_pdo_mysql.dll
- Restart your webserver and reload the page in question
The error should be resolved
Posted in Zend Framework | Leave a Comment »
Posted by mnshankar on October 12, 2008
The Zend Framework relies on a web directive to redirect ALL requests to an index.php page. On an apache server, this is fairly easy to implement using the following statements in a .htaccess file in the public facing folder:
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
A new feature in IIS7 called ‘URL Rewrite’ makes this easy to realize on WIMP/WISP setups. The GoLive (Production) version of the plugin is available here:
(X86)http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1691
(X64)http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1692
The plugin provides a really neat feature to directly import and convert well formed .htaccess files into their IIS equivalents. Using your IIS manager, navigate to the virtual folder (pointing to your public facing folder). Click on the ‘URL Rewrite’ plugin and then the "Open Feature" option.
Now, click on the "Import Rules" option
In the dialog box that appears, select the .htaccess file saved on your computer and click on the "Import" button.
If all goes well, the equivalent IIS rewrite rules will be created! The above procedure actually creates a web.config file in your public folder that looks like the following (Note that you can actually just copy this web.config to your folder instead of going through the above steps):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1">
<match url="\.(js|ico|gif|jpg|png|css)$" negate="true" ignoreCase="false" />
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Posted in Zend Framework | Leave a Comment »