Use separate folder from apache to develop with PHP

Use separate folder from apache to develop with PHP

| April 29, 2012 | 2 Comments

Php_codeMost of php developers use in their local environments a configuration similar to:

  • Apache + PHP + Mysql. It´s very common the use of integrated solutions such us XAMPP.
  • IDE such us Eclipse (eclipse PDT), Zend Studio,etc..
  • A debugger: Zend Debugger is the most recommended.

 

Install XAMPP (or similar solutions) and the IDE is easy and there are many tutorials that talk about it:

But there is one thing that is important to do: put your workspace outside the htdocs folder in your apache server.

Use separate folder from apache to develop with PHP

For this task you only have to add an alias to your apache configuration. Go to your http.conf file:

/APACHEFOLDER/conf/httpd.conf

Remember to save a copy of the file before editing it.

To add an alias you can add the next lines inside <IfModule alias_module> tag:

1
2
3
4
5
6
7
8
#Alias for project
Alias /phplist "D:\desarrollo\workspace\project"
#Directorio para el alias de phplist
<Directory "D:\desarrollo\workspace\project">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all</Directory>

where:

  • /proyect: reference to the url use by apache to publish the site. You can try it putting http://localhost/proyect in your navigator.
  • D:\desarrollo\workspace\proyect\:  your workspace.
  • <Directory>: give permission to workspace folder from apache web server.

——————————————————————

References: