How to resolve linux folder name vs Win7 localhost folder name - php

I have a text file on my Linux website and I'm trying to run my website php code on my Win7 localhost machine.
The text file on the server is located at:
/home/vault/public_html/ssfiles/mysql.txt
On my local machine I'm running Apache/PHP/MySQL and my php files are located in:
C:\wamp\www\
How do I get my php script to open the file with the first folder string and to also work locally with the second folder string?
I'm new to running php on my local machine and have always run my php scripts directly on the Linux server...so I'm not sure how to resolve this?
Is there a php.ini setting that handles this? based on what machine the script is executing on?
Thanks...

If you place the files in htdocs folder in c:\wampp\ you can directly access the file with localhost/folder_name/file_name.php from broswer

Related

How to run PHP files on XAMMP on A Mac

I have saved a PHP file to my Applications/XAMMP/htdocs directory and I want to run it in a browser.
I have used all sorts of url combinations including:
http://localhost/xammp/htdocs/HelloWord.php
http://localhost/xammp/HelloWord.php
amongst others and I cannot find the right url.
I am using XAMPP on a Mac Majove.
If you installed the XAMPP VM version, then you can probably access it via http://192.168.64.2/HelloWord.php (check the General tab in the XAMPP app for the IP address)
If you installed the native version, then I guess it is
http://localhost/HelloWord.php
The htdocs/ folder is the document root. Its content is served under the server address. Neither the xampp nor the htdocs folder will be part of the URL. The paths are relative to the document root, and you shouldn't be able to access parent directories above htdocs/ (although server-side code such as PHP has access to the file system and may work with files outside of the document root).
First of all, expecting the php file to have information that can be visualized in a web browser, inside xampp if you have the .php file in the htdocs folder you should be able to visualize it like this:
http://localhost/HelloWord.php
Found it by trial and error, quite different from what I took from various instructions on line:
http://localhost/HelloWord.php
XAMPP's default root should be "htdocs" or "www". Put your PHP files into those folder and try again.
if it is not work, find the configuration of Apache and PHP in XAMPP folder.

IIS server 7 php 5.3 can not access sub folders

My website runs correctly on xampp server, but I tried the Windows PHP localhost server (IIS), but for unknow, reason mysite.php run but can not show the CSS or the image that are on subfolders
I tried to give full access permission but with not help, and I have no idea what else can I do to make my PHP website able to access the subfolder that contains CSS/images/and txt files.

Access remote Windows server FILES from Linux Apache Webserver via Browser Hyperlink

I have installed an apache webserver on Linux Debian and created an intranet on it. The intranet basically shows tables with entries from sql queries via php and mysql.
In one of these tables I would like to add a hyperlink that leads to/opens files and folders on a remote windows server.
I can access these files on the windows server from my linux webserver via cifs protocol.
How do I tell apache and/or linux where they need to go when a user clicks on a hyperlink in my intranet?
The path for the windows server is: \10.0.10.100\data\moredata\file.xls
I can access the windows server folders on my linux webserver via the following path: /media/data/moredata/file.xls
However, if I place this path inside html tag like this:
open my file please , it won't work.
If I try it like this: open my file please , it also won't work.
I believe that I need to insert the path inside apache.conf ? Is this correct? And if so, how is it done exactly?
You have to create Alias for that. Like 10.0.10.100/media can be pointing to your root /media folder. You can do it in your config file. Hope this link can help.

XAMPP won't open PHP files in directory (Mac)

All the servers are running correctly in XAMPP, and I when I run http://localhost the XAMPP page comes up. However when I try to run a php through xampp by accessing the directory where the file is stored, i.e.,
http://localhost/Applications/XAMPP/xamppfiles/htdocs/gallery.php
I get error 404. I've tried loads of different paths, but here is the path to the file in finder path image
Any ideas?
Thanks!
your webserver is resolving the domain localhost to a specific directory, the so called document root. (this can be adjusted in your server config). I would assume that it points to /Applications/XAMPP/xamppfiles/htdocs. so your file should be accessible via
http://localhost/gallery.php

Run my php files from outside htdocs

I have my xampp installed and running sites from the htdocs folder. I want to create a website directory in a different location and run the files online from there.
I know I can do this somehow using both Virtual Host settings and changing my hosts file in System32.
I want to change my URL from localhost/websites/mysite/ to just mysite/
Can anyone offer assistance, thank you
Locate httpd.conf file on your local XAMPP install:
C:\xampp\xampp\apache\conf\httpd.conf
Edit the “DocumentRoot” line to the location of the remote \htdocs folder.
Example:
“C:/xampp/xampp/htdocs” to “C:/Users/Ann/Documents/My Dropbox/Dev/Xampp/xampp/htdocs”
Edit the “Directory” tag to the same remote location you set for DocumentRoot.
“C:/Users/Ann/Documents/My Dropbox/Dev/Xampp/xampp/htdocs”
Save the file and restart your local Apache server.
Navigate to your "localhost” in your browser and you should see the remote web site files.
You don't have to configure anything and then reconfigure ...
What I do is the following:
I have a simple PHP file in htdocs folder, named 'PHPexec.php', which accepts files from anywhere and it runs them as 'include' files. Example: Suppose you want to run "D:\PHPs\xxx.php'. You run http://localhost/PHPexec.php?f=D:\PHPs\xxx.php. PHPexec.php will receive the pathfile as a $_GET variable and run it as an 'include' file:
$file = $_GET['f']; // After checking if it is set etc.
include $file;
Simple as that. From the moment you create your 'PHPexec.php', you have just to run http://localhost/PHPexec.php?f={PHP_file}. Your PHP file will be run as if it were stored in localhost! No configurations and re-configurations ...
(You can configure your 'PHPexec.php' to also accept variables to pass to the PHP file, etc.)

Categories