4

PHP gets an absolute path with no symbolic links

 2 years ago
source link: https://www.codesd.com/item/php-gets-an-absolute-path-with-no-symbolic-links.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

PHP gets an absolute path with no symbolic links

advertisements

How do I get the absolute path to a file, without following symlinks.

/path/to/some/file
/path/to/some/link -> /path/to/some/file
/path/to/some/directory/

My current working directory is /path/to/some/directory/ and I go realpath('../link) it returns /path/to/some/file.

(I know realpath is supposed to work this way)

Is there a function instead of realpath that would return /path/to/some/link


there's also getcwd(); which I use quite often. Syntactically simpler.

Related Articles

PHP get the absolute path of the URL

I have this URL on localhost: http://localhost:7777/somesite/sites/default/files/devel-7.x-1.5.zip and want to get c:\xampp\htdocs\somesites\default\files\devel-7.x-1.5.zip. As mentioned on this question PHP: Get absolute path from absolute URL: $pat

how to find the complete target file (absolute path) of the symbolic link or the software link in python

when i give ls -l /etc/fonts/conf.d/70-yes-bitmaps.conf lrwxrwxrwx <snip> /etc/fonts/conf.d/70-yes-bitmaps.conf -> ../conf.avail/70-yes-bitmaps.conf so for a symbolic link or soft link, how to find the target file's full(absolute path) in python,

Linux Kernel: Get a real path behind a symbolic link

I'm working on some linux kernel stuff and I have a fake path called /dev/blah/whatever that points to /dev/block/real_device The issue is that lookup_bdev will fail to follow the symlink so I'd like to massage the path upfront by getting the real pa

How do I get the file path from the symbolic link?

How can i get information via php or bash to what file referencing a symlink in linux?If SYMPATH is a symlink to REALPATH, then readlink SYMPATH returns REALPATH

A way to get an absolute path to the PHP file

Is there a way to get the absolute path of a file while having it included in another script? So I'm trying to include a file that's in folder A while I'm in folder B but it keeps trying to refer to folder B's location. I've tried dirname, $SERVER['P

With maven, how can I get the absolute path to where is my root pom?

I need to get the absolute path to a subdirectory located just below where my root pom is. For example the pom is at: c:\somepath\pom.xml I need to get the absolute path to: c:\somepath\myIncludes\ I need this while building in a pom with a path like

How to get the executable path with getcwd when called from a symbolic link in C

Say I have a program, abc in Linux, with a method: char *currentPath(){ char *path=NULL; path = getcwd(path, MAXPATHLEN); return path; } When calling abc directly, this path returns the path that abc is in. If I make a symbolic link to abc, and call

How to get the absolute path of the specific header file?

I have a C file with some #include instructions of header files. I know that when I compile the C file with gcc, the compiler looks for the .h files in the paths contained in the environment variable $CPATH. How can I get the absolute path of a speci

Unable to get the absolute path of a file from $ File :: Find :: name - perl

I am unable to get the absolute path of a file from $File::Find::name. It is showing undef vale as a output. Not able to figure it out why :( can any one please help me out in this Error displayed is : Use of uninitialized value $file_name in concate

How to get the absolute path of the currently selected item in QTreeView

I have a simple QTreeView with a QFileSystemModel pointing to the root directory: #include "mainwindow.h" #include <QApplication> #include <QFileSystemModel> #include <QtGui/QApplication> #include <QtGui> #include <QTr

How to get the absolute path relative to the root of the project without double slash?

I defined this function to get the absolute path relative to the project root: def relpath(*x): return os.path.normpath(os.path.join(os.path.dirname(__file__), '..', *x)) GET_PATH = ( relpath('django/dir/'), #tuple ) The problem is that I get the pat

How do I get the absolute path to the Eclipse installation directory?

I am writing an Eclipse product, composed of plugins. In one of my plugins, I need to get the absolute path to the directory where Eclipse is installed. (i.e. /Applications/Eclipse on Mac or C:\Program Files\Eclipse on Win). Can't find an API for thi

Get the absolute path of the currently edited file in Eclipse

I'd like to write a plugin that does something with the currently edited file in Eclipse. But I'm not sure how to properly get the file's full path. This is what I do now: IFile file = (IFile) window.getActivePage().getActiveEditor.getEditorInput().

Getting the absolute path of a PathBuf

Given a relative path: PathBuf::from("./cargo_home") Is there a way to get the absolute path?It seems I can't delete this answer while it is accepted. See this answer for a more current and complete answer. If I understand the PathBuf documentat

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK