How can I get the current module, controller and action in Zend Framework?

Today I will show you how to get current module, controller and action name in Zend Framework. In the default routing, both the module, controller and the action are always passed along with the request. And the code to retrieve them is very simple:

$moduleName = $this->getRequest()->getModuleName();
$controllerName = $this->getRequest()->getControllerName();
$actionName = $this->getRequest()->getActionName();

And that’s all. Good luck.

Posted in Php, Zend Framework at July 27th, 2011. No Comments.

Install virtual hosts on Wamp

Today I will show you how to install virtual hosts on Wamp server.

First open your hosts file, you can find it in this folder:
C:\Windows\System32\drivers\etc
to edit it you need to have administrator permissions.

After this line:
127.0.0.1 localhost
add new one with name of your domain:
127.0.0.1 test.local
I prefer to use .local for my virtual domains to know is that virtual or real domain name.
Next step is to open httpd.conf file which is locate in:
\wamp\bin\apache\Apache2.2.17\conf
find this line:
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
to enable httpd-vhosts.conf just remove # at the begin of the row. After this open httpd-vhosts.conf for edit.
Add this:

<VirtualHost *:80>
DocumentRoot "C:/wamp/www/test/www"
ServerName test.local
ServerAlias www.test.local
<Directory "C:/wamp/www/test/www">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from 127.0.0.1
</Directory>
</VirtualHost>

Restart your Wamp server and type in your browser test.local .

Posted in Apache at July 8th, 2011. No Comments.

Install APC on WAMP server

The main benefit of APC is to increase the performance of PHP scripts.
How to install APC on WAMP 2.1:
1) Go to http://downloads.php.net/pierre/
2) Download php_apc-3.1-svn20101116-5.3-vc6-x86.zip
3) Copy php_apc.dll to \wamp\bin\php\php5.3.5\ext
4) Enable php_apc extension from WAMP server panel -> PHP extensions

Enable apc extension

5) Open php.ini \wamp\bin\apache\Apache2.2.17\bin and add this:

[APC]
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 64M
apc.max_file_size = 10M
apc.stat = 1

6) Restart Wamp server
7) Open this address http://localhost/?phpinfo=1 in your favourite browser
And check for this section:
Phpinfo page apc
If you see that section, then everything is ok and you successfully installed APC extension on your WAMP server.
UPDATE:
I add new article for WAMP 64bit with APC, you can found it here 64bit wamp

Posted in Php, Wamp at July 6th, 2011. 28 Comments.