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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 14:01:36 2025 UTC