Bug #71055 [Com]: Intepreter compiled with litespeed SAPI breaks __DIR__ in CLI

From: Date: Tue, 08 Dec 2015 10:34:09 +0000
Subject: Bug #71055 [Com]: Intepreter compiled with litespeed SAPI breaks __DIR__ in CLI
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197687@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71055&edit=1 ID: 71055 Comment by: grzegorz129 at gmail dot com Reported by: grzegorz129 at gmail dot com Summary: Intepreter compiled with litespeed SAPI breaks __DIR__ in CLI Status: Open Type: Bug Package: Scripting Engine problem Operating System: Linux x64 PHP Version: 7.0.0 Block user comment: N Private report: N New Comment: I asked a fried using lsws and his PHP presented the same issue. In his case RC7 works correctly while final breaks. So, I think there's a problem with litespeed path and not in my system configuration. luklew@server:/var/www/html/symfony/clean$ php -v PHP 7.0.0RC7 (cli) (built: Nov 17 2015 15:10:42) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies luklew@server:/var/www/html/symfony/clean$ php -i | grep config Configure Command => './configure' '--prefix=/usr/local/lsws/lsphp7' '--with-mysqli' '--with-pdo-mysql' '--with-mysql-sock=/var/mysql/mysql.sock' '--with-zlib' '--with-gd' '--enable-shmop' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--with-iconv' '--with-mcrypt' '--with-openssl' '--with-sqlite3' '--with-litespeed' '--with-bz2' '--enable-zip' '--enable-mbstring' Openssl default config => /usr/lib/ssl/openssl.cnf TEXTDOMAIN => im-config $_SERVER['TEXTDOMAIN'] => im-config luklew@server:/var/www/html/symfony/clean$ php7 app/test.php string(35) "/var/www/html/symfony/clean/app/app" ----- luklew@server:/var/www/html/symfony/clean$ php7 -v PHP 7.0.0 (litespeed) (built: Dec 4 2015 09:58:34) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies luklew@server:/var/www/html/symfony/clean$ php7 -i | grep config Configure Command => './configure' '--prefix=/usr/local/lsws/lsphp7' '--with-mysqli' '--with-pdo-mysql' '--with-mysql-sock=/var/mysql/mysql.sock' '--with-zlib' '--with-gd' '--enable-shmop' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--with-iconv' '--with-mcrypt' '--with-openssl' '--with-sqlite3' '--with-litespeed' '--with-bz2' '--enable-zip' '--enable-mbstring' Openssl default config => /usr/lib/ssl/openssl.cnf TEXTDOMAIN => im-config $_SERVER['TEXTDOMAIN'] => im-config luklew@server:/var/www/html/symfony/clean$ php app/test.php string(31) "/var/www/html/symfony/clean/app" Previous Comments: ------------------------------------------------------------------------ [2015-12-08 10:26:34] grzegorz129 at gmail dot com Related topic on Litespeed Tech. support forum: https://www.litespeedtech.com/support/forum/threads/lsapi-integration-breaks-__dir__-in-cli.13493/ ------------------------------------------------------------------------ [2015-12-08 10:25:36] grzegorz129 at gmail dot com Description: ------------ I have PHP 7 compiled with litespeed SAPI support. Binary works as expected while used with webserver, but acts weird while invoked from console. That bug was introduced in 7.0.0 release and wasn't present in RC8. First of all I tested if __DIR__ implementation is consistent between all PHP versions: https://3v4l.org/1lRa2 - yup, it is. Next I created file inside app catalog named test.php. Than I invoked it from outside of the app directory: root@server:/home/[redacted]# php app/test.php string(19) "/home/[redacted]/app" root@server:/home/[redacted]# php7 app/test.php string(23) "/home/[redacted]/app/app" # php --version PHP 5.6.11 (cli) (built: Jul 13 2015 01:48:23) (DEBUG) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies # php7 -v PHP 7.0.0 (litespeed) (built: Dec 4 2015 10:46:45) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies PHP also thinks files are located elsewhere: require_once(/home/[redacted]/app/app/bootstrap.php.cache): failed to open stream: No such file or directory in /home/[redacted]/app/app/console on line 10 RC8 looks correct though: # php7 test/test.php string(10) "/home/test" # php7 --version PHP 7.0.0RC8 (cli) (built: Dec 2 2015 14:03:35) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies I also spot one difference which may be relevant - running binary from console final version identifies SAPI as "litespeed" while RC8 reports "cli". Configuration ------------- Configuration is identical on both servers. Compilation options: './configure' '--prefix=/usr/local/lsws/lsphp7' '--with-libdir=/lib/x86_64-linux-gnu' '--with-curl' '--with-gd' '--enable-exif' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/lib/x86_64-linux-gnu' '--with-ttf' '--with-gettext' '--with-jpeg-dir=/usr/include' '--with-libpng' '--with-openssl' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-mysqli' '--with-pdo-mysql' '--with-pdo-pgsql' '--with-pear' '--with-zlib' '--enable-zip' '--with-bz2' '--with-iconv' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--with-gmp' '--enable-sockets' '--enable-intl' '--enable-mbstring' '--with-mcrypt=/usr' '--enable-opcache' '--with-litespeed' PHP.ini: memory_limit = 256M date.timezone = "Europe/Warsaw" post_max_size = 16M upload_max_filesize = 10M max_execution_time = 120 enable_dl = Off expose_php = Off intl.default_locale = "pl_PL.UTF-8" mysql.connect_timeout = 5 mysql.default_host = localhost session.cookie_httponly = On session.use_only_cookies = On opcache.enable=1 opcache.memory_consumption=128 opcache.max_accelerated_files=4000 Test script: --------------- <?php //Save in it eg. test/test.php and call using php7 test/test.php //DO NOT enter test directory var_dump(__DIR__); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71055&edit=1

« previous php.bugs (#197687) next »