Peter
Peter

Reputation: 1330

XAMPP - How can I execute PHP files from home directory?

I've installed XAMPP on my Linux computer and server and database are running. Now I have a question how to execute my existing PHP-Files from /home path?

So far I have saved all of my PHP files in ./home directory (e.g. /home/Path-to-PHP-Files/Development_01/....php) and until now I have uploaded them with FTP to server. In order to save myself from constant uploading, I thought that usage with XAMPP is faster and more elegant.

I found out that XAMPP apparently wants to save the PHP files in /opt/lampp/htdocs directory. Unfortunately I can neither call my PHP files from .home-directory in browser nor can I copy them to /opt/lampp/htdocs because this path is read-only. How can I configure XAMPP to make my PHP files run in /home directory?

Upvotes: 0

Views: 1177

Answers (1)

Jay Blanchard
Jay Blanchard

Reputation: 34416

Change the DocumentRoot in your virtual hosts file, then restart XAMPP. Here is an example:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/home/Path-to-PHP-Files/Development_01/"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common
    <Directory C:/home/Path-to-PHP-Files/Development_01/> # or a linux path
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Upvotes: 1

Related Questions