Setting up path mapping in PHP and Eclipse - php

I have just setup my website locally so I can test my pages more easily.
Eclipse has been configured to use an XAMPP server locally.
The problem is that I want to map my project to a certain place in my website.
ie. In my Eclipse PHP project I have a folder called
com
I want this to map to
/com
in the webstie.
I tried to do this in the mapping section of the Eclipse server setup but it didn't work. When I type
http://localhost/com/
It should go to my project folder, however, when I type other folder it should use the normal website folders.
how can I do this?

Well I edited the apache httpd.conf file like this and it works.
#Alias for com folder
Alias /com C:\PHP\workspace-php\php_project\com
<Directory "C:\PHP\workspace-php\php_project\com">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

I'd created my Eclipse workspace exactly on [xampp]\htdocs folder

Related

Access files in home folder with PHP (linux)

I have a php application located in /var/www/phpapp and I need to create links to download files located in the /home/myuser folder. The complete path to the files is stored in a database, so the goal is for the app to place a link like Download 1 and be able to download it. I access the php app using http://localhost/phpapp. I know I can do this using alias in apache but I still haven't figure it out.
For anyone having this same problem, I got it working using this:
In Ubuntu: I went to /etc/apache2/sites-enabled/ and edit the site file
In Centos: Go to /etc/httpd/conf.d/ and add a new xxxx.conf file
And I added this into the file:
Alias /home "/home/user/"
<Directory "/home/user">
Options None
AllowOverride None
Order allow,deny
Allow from all
Options Indexes FollowSymLinks
MultiViews Require all granted
</Directory>

How can I start a laravel project outside of "htdocs" folder in xampp?

Is it a way to start a Laravel project in another folder? For example:
instead of C:/xampp/htdocs
to D:/projects/web/project1
So after I download Laravel with composer to my D:/projects/web/project1 folder I want to reach it as: http://project1.local in my browser.
I added 127.0.0.1 project1.local to my hosts but it only opens xampp in the browser.
Suggestions, ideas?
You need to indicate to xampp that your site will be sited outside the documentroot folder (where all the sites in your server are located).
In your httpd.conf file add these lines, which will allow to you to access the site via http://localhost/laravel.project:
Alias /laravel.project "D:/projects/web/project1/public"
<Directory "D:/projects/web/project1/public">
Options FollowSymlinks
AllowOverride none
Require all granted
</Directory>
If you want to get access directly, via a uri like http://laravel.project, you must create a VirtualHost.

using PHP within WAMP- how can I create new directories on my local drives?

I am trying to use PHP within my WAMP environment to create new directories (checking if they exists first) on a local drive (U:) which is mapped to a media server (\tr-svrwc-fms)- with no success: I receive a 403 error.
I've tried creating directory Aliases:
Alias /vid "tr-svrwc-fms//"
<Directory "tr-svrwc-fms//">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
and also:
Alias /vid "U:"
<Directory "U:">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow, Deny
Allow from all
</Directory>
I've even tried modifying the root directory settings in httpd.conf to "Allow from all".
my WAMP server version is 2.2 with Apache version 2.2.21
thank you in advance for your help
It is recommended to only use only UNC paths for network resources in httpd.conf
The syntax should look something like this:
Alias /vid "//laptop1/vid"
<Directory "//laptop1/vid">
...
</Directory
Where laptop1 of course will be different in your case.
I've learned that with WAMP installed on my local hard drive, the Apache server (as configured) does not allow for communication outside of the WAMP root folder due to permissions.
This type of communication can however be accomplished via a PHP shell script on the Command Line which doesn't route through the Apache Server.

Wamp server alias won't load files

I am using wamp server version 2.4
I have a zend project, and when i create virtual host it works like a charm (http://nasport.localhost/authentication/login). But i need to access it via my IP address (e.g. 127.0.0.1/nasport/). I made an alias in wamp, but when I go to that page, i get only ugly page without css, and login is not working too because it can't access other files. Here is my alias:
Alias /nasport/ "d:/dev/php/nasport/public/"
<Directory "d:/dev/php/nasport/public/">
Options Indexes FollowSymLinks
MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
Please help me.

In which directory i should keep my workspace or project

I have installed XAMPP in my machine(Windows XP OS). And I have Eclipse as IDE.
Now my question is, In which directory i should keep my workspace (or project).
Whether I should keep under the path "C:\xampp\php\www" OR under "C:\xampp\htdocs".
You need to change the DocumentRoot value in c:\xampp\apache\conf\httpd.conf from
DocumentRoot "C:\xampp\htdocs"
to
DocumentRoot "E:/MyProject/Source/Admin"
and configure permissions also.
<Directory "E:/MyProject/Source/Admin">
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
and then restart the apache server(in xampp control panel). so from there onwards whenever you access http://localhost/ it will execute the files under E:/MyProject/Source/Admin
see for more info.
http://httpd.apache.org/docs/2.0/mod/core.html#documentroot
http://www.apachefriends.org/en/xampp-windows.html#529
Looking at the Where I change the start page? section of XAMP's FAQ (quoting) :
The DocumentRoot folder is
"\xampp\htdocs". There is the
index site (index.php) the real
start page which is loaded after
executing of "http://localhost/".
So, I'd say, in your case, you'll have to work in C:\xampp\htdocs.
Still, of course, you can change that by modifying Apache's configuration and/or creating new VirtualHosts.

Categories