[Solved] PHP Fatal error: Phar::webPhar(): Failed opening

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
TannSan
New Member
New Member
Posts: 6
Joined: Tue Oct 04, 2016 8:28 pm

[Solved] PHP Fatal error: Phar::webPhar(): Failed opening

Post by TannSan »

Hi all, I've been running into a problem on my Plesk CentOS server since CMS MS switched to using the PHAR installer. The initial install screen would display (where you can select Language & Advanced Mode) but after that I would get a white screen with a note like this in the error log:

Code: Select all

mod_fcgid: stderr: PHP Fatal error: Phar::webPhar(): Failed opening required 'phar:///var/www/vhosts/somedomain.com/cmsms-2.2.1-install.php/index.php' (include_path='phar:///var/www/vhosts/somedomain.com/cmsms-2.2.1-install.php:.') in /var/www/vhosts/somedomain.com/cmsms-2.2.1-install.php on line 8, referer: https://somedomain.com/cmsms-2.2.1-install.php/index.php
After screaming out loud and trying several different include path options in the Plesk PHP settings page for the domain I finally sussed it out.

The solution for me was to set opcache.enable to off. In Plesk you access this via Domains->Domain You're Working On->PHP Settings. After the CMS install is done and you can access the CMS admin interface you can turn the opcache option back on. Just remember to disable it each time you do a CMS MS PHAR file update and enable it again afterwards.

CentOS 6.9
Plesk Onyx Version 17.5.3
PHP 5.6.30
tristan
Dev Team Member
Dev Team Member
Posts: 321
Joined: Tue May 02, 2006 10:58 am
Location: The Netherlands

Re: [Solved] PHP Fatal error: Phar::webPhar(): Failed openin

Post by tristan »

Great find, had the exact same problem over here with the 2.2.3.1 Phar installer on PHP 7.0.24 with OPCache enabled. Submitted it as a bug here:

http://dev.cmsmadesimple.org/bug/view/11591
urbini
Forum Members
Forum Members
Posts: 28
Joined: Sun Dec 16, 2012 11:41 pm

Re: [Solved] PHP Fatal error: Phar::webPhar(): Failed openin

Post by urbini »

Hi. I face the same problem upgrading from 2.2.2 to 2.2.3.1.
What should I do in order to manage to upgrade?
Below my system imformations.
Thanks a lot


CMS Made Simple Install Information
CMSMS Version 2.2.2


Installed Modules
AdminSearch 1.0.4
CGBlog 1.15.1
CGContentUtils 2.2.2
CGExtensions 1.57.1
CGFeedback 2.1
CGSimpleSmarty 2.1.7
CMSContentManager 1.1.5
CMSMailer 6.2.14
Captcha 0.5.5
CmsJobManager 0.1
DesignManager 1.1.3
FileManager 1.6.3
FilePicker 1.0
FormBuilder 0.8.1.6
Gallery 2.3.2
JQueryTools 1.4.0.3
MicroTiny 2.2
MleCMS 2.0-beta1
ModuleManager 2.1.1
Navigator 1.0.7
News 2.51.2
Search 1.51.2
Showtime2 3.5.4
SiteMapMadeSimple 1.2.8
ThemeManager 1.1.8


CMS Made Simple Config Settings
php_memory_limit 256M
max_upload_size 10000000
url_rewriting mod_rewrite
page_extension .html
query_var page
auto_alias_content true
locale
set_names true
timezone Europe/Rome
permissive_smarty false


Performance and Tuning Information (recommended settings, but not required)
Allow Browser to Cache Pages Caution Off (False)
Allowing browsers to cache pages will improve performance by not requiring your system to serve the page on repeated visits to a page.
Browser Cache Expiry Period (minutes) Success 60
PHP 5.5+ Opcode Cache Success On (True)
Enable Smarty Caching Caution Off (False)
Enabling Smarty caching can have serious performance benefits for most websites.
Do a Compilation Check Success Off (False)
Remove cache files that are older than the specified number of days Caution Off (False)
The system should be configured to destroy old temporary files after a reasonable time to improve performance and minimize disk space requirements


PHP Information
Current PHP Version (phpversion) Success 7.0.23
md5 function (md5_function) Success On (True)
JSON functions (json_function) Success On (True)
GD version (gd_version) Success 2
tempnam function (tempnam_function) Success On (True)
Magic quotes in runtime (magic_quotes_runtime) Success Off (False)
Is E_ALL enabled in error_reporting (E_ALL) Success
Is E_STRICT disabled in error_reporting (E_STRICT) Caution E_STRICT is enabled in the error_reporting
Is E_DEPRECATED disabled in error_reporting (E_DEPRECATED) Caution E_DEPRECATED is enabled
Testing for time difference in the file system (test_file_timedifference) Success No time difference found
Testing for time difference in the database (test_db_timedifference) Success No time difference found
Checking if the HTTPD process can create a file inside of a directory it created (create_dir_and_file) Success 1
PHP Effective Memory Limit (memory_limit) Success 256M
Maximum Execution Time (max_execution_time) Success 120
PHP register_globals (register_globals) Success Off (False)
PHP output_buffering (output_buffering) Success On
disable_functions in PHP (disable_functions) Caution dl, passthru, proc_open, proc_close, proc_terminate, shell_exec, system ?
PHP Open Basedir (open_basedir) Caution /home/hotellad/:/opt/cpanel/ea-php70/root/usr:/usr/local/lib/php:/tmp:/etc/pki/tls/certs/ca-bundle.crt:/var/cpanel/php/sessions ?
Test for remote URL (test_remote_url) Success Success
fsockopen: Connection ok! Success
fopen: Connection ok! Success
File uploads (file_uploads) Success On (True)
Maximum Post Size (post_max_size) Success 150M
Maximum Upload Size (upload_max_filesize) Success 10M
Session Save Path (session_save_path) Caution No check because open basedir active ?
Sessions are allowed to use Cookies (session_use_cookies) Success On (True)
Basic XML (expat) support (xml_function) Success On (True)
Checking for the XMLReader class (xmlreader_class) Success On (True)
Test ini_set (check_ini_set) Success On (True)
Test for the curl library (curl) Success On
Test curl version (curlversion) Success version 7.55.1, minimum recommended version is 7.19.7


Server Information
Server Software (server_software) apache
Server API (server_api) cgi-fcgi
Server Operating System (server_os) linux 3.10.0-514.21.2.el7.x86_64 on x86_64
Server Database (server_db_type) mysql (mysqli)
Server Database Version (server_db_version) Success 5.6.37
Check database access levels (server_db_grants) Caution could not find a suitable "grant all" permission, this does not necessarily lead to problems... but if you have problems installing/removing modules or adding and deleting items/pages this could be the cause!
tristan
Dev Team Member
Dev Team Member
Posts: 321
Joined: Tue May 02, 2006 10:58 am
Location: The Netherlands

Re: [Solved] PHP Fatal error: Phar::webPhar(): Failed openin

Post by tristan »

Adding:

Code: Select all

php_flag opcache.enable Off
to .htaccess worked for me, don't forget to comment that line after a successful upgrade.

Edit; if you're running as CGI/FastCGI add this line to a .user.ini file:

Code: Select all

opcache.enable=0
urbini
Forum Members
Forum Members
Posts: 28
Joined: Sun Dec 16, 2012 11:41 pm

Re: [Solved] PHP Fatal error: Phar::webPhar(): Failed openin

Post by urbini »

I'm running as CGI/FastCGI so I've tried to create a .user.ini file in the public_html root with the line:
opcache.enable=0
but it doesn'r work.
I've tried also with php_flag opcache.enable Off in .htaccess, but nothing :(
What should I do? Should I ask to the provider to disable opcache?
thanks
tristan
Dev Team Member
Dev Team Member
Posts: 321
Joined: Tue May 02, 2006 10:58 am
Location: The Netherlands

Re: [Solved] PHP Fatal error: Phar::webPhar(): Failed openin

Post by tristan »

Did you actually saw a change on the System Information page for opCache? Do you have the server log to make sure you actually have the same problem?
urbini
Forum Members
Forum Members
Posts: 28
Joined: Sun Dec 16, 2012 11:41 pm

Re: [Solved] PHP Fatal error: Phar::webPhar(): Failed openin

Post by urbini »

What I did:
I've put a file .user.ini in the public_html with the line:
opcache.enable = 0
But through phpinfo(), in the section Zend OPcache, opcache.enable remains On both for Local Value and for Master Value.

What happens:
When I start the upgrade process of the website through <url-website>/cmsms-2.2.3.1-install.php, the first page opens (1. Welcome), but when I click Next I get a blank screen.
In the error_log_php I find the following fatal error:
[21-Oct-2017 16:00:59 Europe/Rome] PHP Fatal error: Phar::webPhar(): Failed opening required 'phar:///home/hotellad/public_html/cmsms-2.2.3.1-install.php/index.php' (include_path='phar:///home/hotellad/public_html/cmsms-2.2.3.1-install.php:.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/hotellad/public_html/cmsms-2.2.3.1-install.php on line 8

This continues to happen despite the .user.ini file, so maybe I have to ask the provider to disable opcache?
tristan
Dev Team Member
Dev Team Member
Posts: 321
Joined: Tue May 02, 2006 10:58 am
Location: The Netherlands

Re: [Solved] PHP Fatal error: Phar::webPhar(): Failed openin

Post by tristan »

Yeah that would be the only solution if trying to disable it yourself doesn't help. Maybe he has another option on how to do this with FCGI, no experience with that over here unfortunately.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: [Solved] PHP Fatal error: Phar::webPhar(): Failed openin

Post by calguy1000 »

Note 1: This error only happens in 'SOME' environments. I have a php-fcgi environment with opcache enabled and PHP 7.0.22 and the phar installer works fine.

Note 2: This is not a CMSMS specific error because
a: It's not even getting to the CMSMS code before the error occurs.
b: The 'stub' we use is the standard one provided by the PHP environment we used to build the phar.

Note 3: .user.ini MAY NOT work in your environment (phpinfo would tell you) what files are available to put custom php directives in. If any.

Workaround: You can always use the expanded installer.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Locked

Return to “[locked] Installation, Setup and Upgrade”