php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60075 using -t /myPath does not add /myPath to include_path
Submitted: 2011-10-17 07:59 UTC Modified: 2021-08-11 10:11 UTC
Votes:5
Avg. Score:3.4 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: paul dot a dot norman at gmail dot com Assigned: cmb (profile)
Status: Wont fix Package: Built-in web server
PHP Version: 5.4.0beta1 OS: Win32
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-10-17 07:59 UTC] paul dot a dot norman at gmail dot com
Description:
------------
If the php internal server is launched using php -S localhost:8001 -t /myPath 
server_process.php

and server_process.php is in /myPath the following would result

Warning: Unknown: failed to open stream: No such file or directory in Unknown on 
line 0

Fatal error: Unknown: Failed opening required 'server_process.php' 
(include_path='.;C:\php\pear') in Unknown on line 0

Obviously using: ... -t /myPath /myPath/server_process.php
works as expected, 

but it would seem intuitive that when using: 

php -S localhost:8001 -t something

that "something" would be automatically added to the include_path ?

P.S. the php internal server is a brilliant addition, facilitates making virtual 
desktop applications in the browser a cinch! Allows the leveraging of browser 
technology jQuery and all the rest with php on the client -- very powerful!!!

Add in http://gluescript.sourceforge.net/ http://gtk.php.net/ or simillar for 
local wxWdiget dialogues called as necessary from php 
http://php.net/manual/en/function.system.php and an almost complete powerful  
solution is available.

Paul



Patches

php_cli_server_add_docroot_to_include_path (last revision 2012-03-04 18:01 UTC by stuart at 3ft9 dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-04 18:04 UTC] stuart at 3ft9 dot com
This is my first patch so I may have missed something. This patch simply prepends 
the document root to include_path for each request.
 [2012-03-05 22:12 UTC] stas@php.net
-Assigned To: +Assigned To: moriyoshi
 [2012-03-08 05:09 UTC] reeze dot xia at gmail dot com
Hi, Stuart

    I think add doc-root to include_path may impact the behavior of your 
application, because this changes the include path of your application too. 
maybe some application didn't add docroot to it's include_path , but the server 
add it. (include require autoload etc.).

    if you just want to set router script easily, I don't think it deserve the 
change.  And this behavior different with the way we use cli tools:
ie:
$ ls -l file.php
just print the information of  $PWD's file.php but not some other folder's 
file.php. This is confusing

If we want to add include path maybe a new option like -I /new/include/path 
maybe useful.

so -1 for me ;-)

Thanks.
reeze
 [2012-03-13 15:13 UTC] lynch@php.net
You don't need a new flag.

php -B ini_set('include_path', get_include_path() . PATH_SEPARATOR . '/myPath')

NOTE:
Never used -B, so maybe you need "" around it or whatever, but you get the point.
 [2016-12-01 13:52 UTC] cmb@php.net
> but it would seem intuitive that when using: 
>
> php -S localhost:8001 -t something
>
> that "something" would be automatically added to the include_path ?

IMHO no, because I wouldn't put the router script in the docroot in the first place.
 [2017-10-24 06:33 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: moriyoshi +Assigned To:
 [2021-08-11 10:11 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-08-11 10:11 UTC] cmb@php.net
For the stated reasons, this is unlikely to be implemented, so I'm
closing the ticket as WONTFIX.  If anybody still thinks this would
be a good feature, please pursue the RFC process[1].

[1] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 09:01:30 2024 UTC