How do I create an alternative root for XAMPP? - html

I understand that the root of xampp is the htcdocs directory - but I want to create my own directory in my home folder and have that server as my root so that I don't have to go through a million folders to save a file.
I can accomplish this using a symbolic link, but is there a better way to do this????
Thanks so much.

You'll need to edit your httpd.conf file and the restart the server. There should be two things you'll need to replace: the DocumentRoot={current} and a . Just replace the existing path with the path you'd like it to be and restart apache. It should now be serving from the new directory instead of the old one.
You can also use virtual hosts to assign the directory in your home folder to a new domain/ipaddress/port/whatever, but that's quite a bit harder to do.

You can use following link to create Virtual Host -
http://www.mikebernat.com/blog/Adding_Virtual_Hosts_to_Apache_&_Wampserver
Although this is for WAMP. Same information can be used for XAMP

Related

How can I disable direct access to a folder html page?

Heres the scenario: In the root of the server i have an folder named "data".
In this folder is a file named "random-file.html". Now I want, that you can't see the contents of the folder "data" if you type "domain.com/data/" but you have access to the file "random-file.html" and can it.
Sure you can. You can hide it using .htaccess. I assume you use xampp server. You can see this [1] https://www.opentechguides.com/how-to/article/apache/115/htaccess-file-dir-security.html
If I recall correctly, the most secure practice is to keep sensitive files outside the root of your webserver all together. Create a folder on the VM or server which your app is hosted and have your application read/write/use it from there.
Most serverside frameworks/tools have a "websecrets" type functionality you could use. But this step above is my 'framework agnostic' advice.

How to change MySQL data directory to workspace folder for syncing databace between devices?

My problem is that I want to have my MySQL database in my workspace folder. I want to sync my database for all of my workdevices, so that i dont have to export my data every single time a change something.
I tried to create just a softlink to the direktory on every device I use with the mklink /D command in the commandline but I see that this doesn'n work.
Have you any idea how i can configure my database right this?
Here is the solution on stackexchange site : change data dir path
Just follow the step by step solution by RolandoMySQLDBA

How to create a website with xampp?

I created this little html file test.html:
<p>It works!</p>
and try to host it with apache. I downloaded and installed XAMPP and started apache. But where to put test.html so i can access it in the browser?
I search now for 30 minutes but can't find anything to start with.
xampp/htdocs folder, this is where index.html takes place.
You can access it via your browser like this: http://localhost/index.html
In order to add/view new files/projects, just add them to htdocs directory and access them via localhost/filename address.
Hope it works :)
In XAMPP root directory you can find 'htdocs' folder. You could create here a new folder for each web that you want to create and put inside your files. You can access in your browswer like:
http://localhost/test.html
http://localhost/NewFolder/test.html

What is the equivalent of C:/ in mysql using linux?

I have this code but I can' figure out how to change the C:/ drive to an equivalent of linux. Below is the code:
SELECT * INTO OUTFILE 'C:/CountryLanguage.txt' FROM CountryLanuage;
I have tried doing '/student', '/home', '/usr', and just plain '/CountryLanguage' I am not sure what to do. Can someone please help me?
Thanks,
Well, this depends on where you would like to save the file.
If you would like to save it in for example "/student" you'll first have to create this folder in the root folder "/". Creating a folder is done by typing:
cd /
mkdir students
Once the directory is created you can make sure it's there by typing:
ls /
Which display all the files and folders in /.
ls /students
Displays all the files in the /students folder.
Since this is in the Linux root you'll have to change the permissions for the folder so that MySQL can write to it. This by typing:
chmod 777 /students
You shall only use 777 for testing since this allows everyone to read, write and execute in that folder but i advise using this to make sure it's not the permissions causing an error.
EDIT:
If you don't have root access to the system you should try saving your file to "/var/lib/mysql/" where MySQL can write.

Fortrabbit And phpMyAdmin: installation clarification

I've been following the Fortrabbit's guide to install phpMyAdmin.
I've managed to put the folder in my htdocs, but from what I read I must actually upload it into the app root below htdocs. Problem is the app root has write protection and I can't seem to change permissions via SFTP.
Any solutions?
Edit
Solved. I had my Root Path under settings set to htdocs/public, so I couldn't hit the phpMyAdmin folder. Setting the Root Path back to htdocs/ enabled me to access it like normal.
Where did you read it must go to the app root? I don't see that in the tutorial, but admit I may have missed it. Also, I'm not clear what you mean by "app root".
Note that in this case, there are three different 'root' folders, be careful not to get confused.
The file system root, /. All the files on your server live here. Depending how fortrabbit configures their system, you may not even have access to this.
The web folder root. Files in this folder and below are available online through your webserver.
The SFTP root. This also depends on how fortrabbit configures their server, it could be your web root, the file system root, or your home directory. You may be able to change to other folders, or maybe not.
Normally, htdocs is the root or base folder where your webserver is looking for files to serve. It isn't clear from my browsing the fortrabbit site if they do anything odd with their configuration, so this is a close approximation for what most servers look like. For the sake of illustration, we'll pretend that htdocs is in /var but it can be anywhere on disk.
So the file system might look a bit like:
/
/bin/
/etc/
/home/MichaelHanslo/
/home/MichaelHanslo/budget_presentation.odf
/var/
/var/htdocs/
/var/htdocs/index.html
/var/htdocs/pma/
/var/htdocs/calendar/
/var/htdocs/calendar/modify.php
/var/logs/
So in that scenario, going to http://example.com/ loads the file /var/htdocs/index.html, going to http://example.com/calendar/modify.php loads /var/htdocs/calendar/modify.php. So in most cases, you want to create a folder under htdocs for phpMyAdmin; you can call it anything you want (in my example above, I used 'pma'). Anyway, if you don't have permission to create the folder under your web root, then you should definitely ask your host for help, because something isn't right.
Hope that helps clear it up for you.