php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67568 PHP cannot run a command line application if there is a dash in its path
Submitted: 2014-07-04 09:11 UTC Modified: 2014-07-04 10:16 UTC
From: tom at r dot je Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 5.5.14 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tom at r dot je
New email:
PHP Version: OS:

 

 [2014-07-04 09:11 UTC] tom at r dot je
Description:
------------
This fails:


php /foo/bar-baz/foobar.php


with the error:

"Could not open input file /foo/bar-baz/foobar.php"

Similarly, 


cd /foo/bar-baz
php foobar.php

fails with the same issue.


Removing the hyphen so the full path to the script is:

/foo/barbaz/foobar.php


Fixes the issue.

I just spent 40 minutes pulling my hair out trying to get better output, checking file permissions, trying the same script in other directories until I worked out it was the hyphen.


Ideally, php shouldn't break with a hyphen in a path name, however, at worst a more descriptive error message would at least prevent the time wasted tracking this down





Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-04 09:35 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2014-07-04 09:35 UTC] requinix@php.net
PHP most certainly does work with files that have hyphens in their names. There's something else going wrong for you.
 [2014-07-04 10:16 UTC] mike@php.net
What does `type -a php` give you?
Upload the output of `strace php /path/to/your-script.php` somewhere.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:29 2024 UTC