I was following instructions to install get to clone a repository and then all of the sudden I started getting "bin/magento must be run as a CLI application" error.
When I did php -v, it shows:
ea-php-cli Copyright 2016 cPanel, Inc.
PHP 7.0.17 (cgi-fcgi) (built: Apr 5 2017 23:22:19)
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.17, Copyright (c) 1999-2017, by Zend Technologies
I've sincerely searched for hours to change this back to show (cli), but so far no luck.
I've reinstalled ea-php-cli via yum but nothing has changed.
When I stopped and restarted the httpd, I get a bunch of errors like this one:
[alias:warn] [pid 31484] AH00671: The ScriptAlias directive in
/etc/apache2/conf/httpd.conf at line 645 will probably never match
because it overlaps an earlier ScriptAlias.
Does anyone know the command to change the php mode to cli mode rather than cgi-fcgi mode? If not, do I need to uninstall and reinstall php?
Update
so after some research I realized that it has to do with the Server API where it's set up as FPM/FAstCGI rather than Apache 2.0 Handler. I will have to research this and then find out how to switch the server API back to Apache Handler... I'm running Centos 6.9 so if anyone has an easy solution, I'd greatly appreciate your input.
More Update
The only thing I can think of that may have affected the Server API to switch is a few of the patches I have made. Here's a list of all the patches and changes made to the server today:
Apr 15 12:47:02 Installed: kernel-2.6.32-696.1.1.el6.x86_64
Apr 15 13:14:02 Installed: 1:perl-Error-0.17015-4.el6.noarch
Apr 15 13:14:02 Installed: perl-Git-1.7.1-8.el6.noarch
Apr 15 13:14:03 Installed: git-1.7.1-8.el6.x86_64
Apr 15 19:21:49 Erased: epel-release
Apr 15 20:33:45 Installed: ea-php-cli-0.2.0-1.1.1.cpanel.x86_64
Apr 15 21:00:58 Installed: ea-php-cli-0.2.0-1.1.1.cpanel.x86_64
Apr 15 22:32:44 Installed: ea-php-cli-0.2.0-1.1.1.cpanel.x86_64
After 15 hours of searching for an answer, I finally got it resolved.
Simply add source /opt/cpanel/ea-php70/enable to /etc/bashrc and php -v results in showing cli.
PHP 7.0.17 (cli) (built: Apr 5 2017 23:21:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.17, Copyright (c) 1999-2017, by Zend Technologies
Related
I am following the instructions here to install the Filerun app on my Nginx server, running on Ubuntu / Raspberry Pi 4.
I downloaded the aarch64 version of IonCube and created a file /etc/php/7.4/fpm/conf.d/00-ioncube.ini with contents
zend_extension = /usr/lib/php/ioncube/ioncube_loader_lin_7.4.so
I verified that the referenced so file exists.
I then ran sudo systemctl restart php7.4-fpm and it shows that the service is running.
But when I do php -v I don't see IonCube mentioned:
$ php --version
PHP 7.4.33 (cli) (built: Nov 8 2022 11:40:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
And when I visit the actual site I get an error saying:
Site error: the ionCube PHP Loader needs to be installed.
I had the wrong version of IonCube. You can run php -i | head -5 to see the architecture:
phpinfo()
PHP Version => 7.4.33
System => Linux raspberrypi 5.15.76-v7l+ #1597 SMP Fri Nov 4 12:14:58 GMT 2022 armv7l
Build Date => Nov 8 2022 11:40:3
In my case it's armv7l (I was wrong to think it was aarch64).
Downloading the correct version from here solved the problem https://www.ioncube.com/loaders.php
The question is the following: what are the minimal-required steps to have PhpStorm configured for using built-in web-server on Mojave system?
I mean, installing the least possible additional software on my system (just started from scratch recently and want to keep number of installed software at the minimal level).
I have php and php-fpm installed "out of the box":
$ php -v
PHP 7.1.19 (cli) (built: Aug 17 2018 18:03:17) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
$ php-fpm -v
PHP 7.1.19 (fpm-fcgi) (built: Aug 17 2018 18:03:20)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
Still, when trying to configure "PHP interpreter" in PhpStorm, I end up with this error message:
php-cgi not found: Please ensure that configured PHP Interpreter built
as CGI program (--enable-fastcgi was specified)
Doesn't php-fpm implement Fast-CGI?…
I recently installed PHP54 on a RHEL 6.5 server from the RHN Software Collection 1.1
The package has successfully been installed, and it needs to be mentioned there is an existing previous installed PHP version (5.3.3) on the servers which is the current enabled version.
I have checked several sites/forums/blogs and the suggestions are always the same, enable via scl (Setup and run software from Software Collection environment) and/or sourcing the file "/opt/rh/php54/enable". This seems to be a proper workaround to enable PHP54 as can be seen in the commands below.
But it is not permanent, as soon as I exit the shell the user who enabled PHP the changes are discarded.
NOTE: the commands has been run as "root" with the exact same behaviour shown in the following commands.
I've found references to add the source workaround into the ".bash_profile" of the user(s), but does not seems to be the best solution for me, I am wondering if someone else have already faced this problem and how it was solved.
Any suggestions?
[mithrandir#mordor ~]# scl enable php54 "php -v"
PHP 5.4.16 (cli) (built: Feb 4 2014 08:10:51)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[mithrandir#mordor ~]# php -v
PHP 5.3.3 (cli) (built: Jul 15 2014 08:48:08)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
[mithrandir#mordor ~]# source /opt/rh/php54/enable
[mithrandir#mordor ~]# php -v
PHP 5.4.16 (cli) (built: Feb 4 2014 08:10:51)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[mithrandir#mordor ~]# date
Fri Aug 29 12:29:35 MDT 2014
[mithrandir#mordor ~]# exit
logout
[me#mordor ~]$ sudo su -
[sudo] password for me:
[mithrandir#mordor ~]# php -v
PHP 5.3.3 (cli) (built: Jul 15 2014 08:48:08)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
[mithrandir#mordor ~]# date
Fri Aug 29 12:29:57 MDT 2014
It seems that in order to enable a package from the RH Software Collection the only way is by adding a script under "/etc/profile.d" and including the "source /opt/rh/php54/enable" command.
This is a link to RH devs blog, showing the solution. Be aware that it is for python33 but this workaround applies for software included on RHSC such as PHP54.
Permanently Enable a Software Collection
I implemented the solution and it is working. I hope this helps someone else.
Open a command shell window and check the PHP rpm package which is installed.
# rpm -qa | grep php
There should be an Apache php module. You need to download a rpm file which adds PHP to your Apache web server.
Use the website http://blog.famillecollet.com/post/2013/06/16/Red-Hat-will-provide-PHP-5.4-for-RHEL-6.
Here you find the hints how to permanently install PHP 5.4.:
# source /opt/rh/php54/enable
# php -v
PHP 5.4.14 (cli) (built: May 23 2013 07:42:19)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
If you want PHP 5.4 permanently enabled and your /etc/conf.d/ directory has the conf file for PHP 5.4 (possibly php54-php.conf) in it, you can comment out the lines in /etc/conf.d/php.conf that load the PHP 5.3 modules:
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
You can also delete /etc/conf.d/php.conf or rename the file to remove the .conf extension so that it isn't loaded by /etc/conf/httpd.conf. After doing either of these, restart Apache to load PHP 5.4.
I just updated to php 5.4 using http://php-osx.liip.ch/ on osx lion.
when i type:
php -v
i still see:
PHP 5.3.15 with Suhosin-Patch (cli) (built: Jul 31 2012 14:49:18)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
But phpinfo() shows 5.4.
How do i update this?
Just Export installed PHP path ,type this on Terminal
export PATH=/usr/local/php5/bin:$PATH
I checked that /usr/local/php5/bin/php existed. It did, so I added /usr/local/php5/bin to my PATH.
Thank you #AD7six
The answer shared by both Chutipong Roobklom and user1168427 helped, if you want to update to the latest php cli which is 7.2.7 (most current and stable release as of 2018 when this post was created originally so check the latest php version, methods for switching versions may vary) then just use this instead of the php5 command. export PATH=/usr/local/php7/bin:$PATH then type php -v and you should have something that reads like this(on MACOSX by the way):
PHP 7.2.7 (cli) (built: Jun 22 2018 06:27:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.7, Copyright (c) 1999-2018, by Zend Technologies
so you shouldn't be getting any errors. Hope this helps and for Kamel, that is how it is installed. You're kind of 'exposing' it in a way for your machine to now recognize which php version you are using.
I am receiving the following error when trying to use the PHP shared memory function shm_attach():
PHP Fatal error: Call to undefined function shm_attach().
I have looked at my php.ini configure command via phpinfo(), and it seems to contain the necessary extensions enabled:
Configure Command => './configure' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu'
...
'--enable-sysvmsg=shared' '--enable-sysvshm=shared' '--enable-sysvsem=shared'
...
I do not see a reference in my php.ini file to any lines like these:
extension=sysvmsg.so
extension=sysvsem.so
extension=sysvshm.so,
so when I added these to my php.ini file in the hopes that it would possibly do something, it merely threw an error.
In my PHP version on my localhost (Ubuntu), I didn't need to download and install any extensions for these type of functions to work, they were installed be default and worked out of the box.
PHP 5.3.6-13ubuntu3.6 with Suhosin-Patch (cli) (built: Feb 11 2012 02:17:16)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
The server I am having the issue on is using a different configuration:
Linux version 2.6.35.6-45.fc14.x86_64 (mockbuild#x86-02.phx2.fedoraproject.org) (gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) ) #1 SMP Mon Oct 18 23:57:44 UTC 2010
and PHP:
PHP 5.3.8 (cli) (built: Sep 28 2011 17:34:42)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
Any suggestions as to what might have caused the extension to have been installed incorrectly?
Any solutions?