0

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?

Peter
  • 1,224
  • 3
  • 16
  • 28
  • There is an `.ini` file you can edit to point to the base for htdocs. Im not verse with linux so i dont know what that file is called. – GetSet Feb 13 '20 at 18:43
  • Does this answer your question? [Make XAMPP/Apache serve file outside of htdocs](https://stackoverflow.com/questions/1408/make-xampp-apache-serve-file-outside-of-htdocs) – gre_gor Feb 13 '20 at 18:46
  • @gre_gor: not really. Link refers only for Windows. I'd like to now usage for Linux. – Peter Feb 13 '20 at 18:48
  • 1
    Usage for Linux is essentailly the same, save for the path to the directory. – Jay Blanchard Feb 13 '20 at 18:50
  • Where can I find `httpd-vhosts.conf` and how to edit? – Peter Feb 13 '20 at 19:10

1 Answers1

1

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

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    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>
Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
  • Button "Open Conf File" allows only to edit `httpd.conf`. Where can I find `httpd-vhosts.conf` and how to edit? – Peter Feb 13 '20 at 19:25
  • You can change the `DocumentRoot` in the httpd.conf too. The vhosts file is in `/xampp/apache/conf/extra ` – Jay Blanchard Feb 13 '20 at 19:26