I am trying to install extension by command.
In server already configure the PHP CLI and I'm using this code :
shell_exec('php-cli '.$SitefilePath.' --package='.$packagePath.'');
I have upload the file:
https://raw.githubusercontent.com/akeeba/vagrant/master/vagrant/files/joomla/install-joomla-extension.php
In the CLI folder and pass path as SitefilePath into command.
but its not working.
I have checked with all option :
http://www.php-cli.com/php-cli-options.shtml
Let me know how to get this work.
All of these issues have been properly debugged in the install-joomla-extension.php script I wrote.
First, create a new plain text file and paste that code in it. Save it as install-joomla-extension.php in your Joomla! site's cli directory. The name is not important, the location (cli directory) is.
Now you can call it like this:
cd /path/to/site/cli php ./install-joomla-extension.php --package=/where/is/your/extension.zip
The script returns one of the following exit statuses:
The extension was installed successfully.
The package file was not found.
The package file could not be extracted.
The extension could not be installed.
You can copy this file to your site's cli directory and install extensions and extension updates any time you want.
Source: https://www.dionysopoulos.me/238-installing-joomla-extensions-from-the-command-line.html
Let me know if this works.
Related
I am trying to install Symfony 2.7 as instructed by the manual.
When I open CMD (I am running it as an administrator in Windows 8.1) the default path is C:\Windows\System32. I have tried running the command specified in the documentation there (c:\> php -r "readfile('http://symfony.com/installer');" > symfony), as well as in the root directory, both give me the same error.
I am using WAMP, the appache rewrite module and php_xls are activated.
I've also added the following to the PATH in the environment variables: ;C:\wamp\bin\php\php5.2.5;C:\wamp\bin\mysql\mysql5.0.45\bin
After having added it, I rebooted the computer and still nothing worked. How can I install Symfony 2.7?
Here is the solution to your original problem:
You just have to make sure that the path to your php executable is correct when you add it to your PATH environment variable. This path is probably related to the version of PHP you have. You should be able to find this path by navigating inside your wamp installation and looking for the php folder and binary. In your case, this would be C:\wamp\bin\php\php5.5.12
However, for the new problem you have...
However, I get the error The directory name is invalid when I execute
the following command: c:>projects\ php symfony
You just have to make sure that your PATH is updated with the correct path for your php, and then do this from C:>
php projects\symfony
Note that php is the executable and projects\symfony is the path to the symfony file.
I'm currently experimenting with WP-CLI (http://wp-cli.org) - I have finally managed to get it to run on my basic command line by downloading/moving it to a PATH variable directory (i.e C:\xampp\php) and then updating my PATHSPEC to include .PHAR.
I have renamed the original file from wp-cli.phar to wp.phar in order to be able to reference it as wp in my cmd.exe.
Prior to this method I installed wp-cli using CURL and chmod in my Git Bash installation then renaming the file to wp (without an extension) and adding the path containing file to the PATH variable. This caused the .PHAR file to work in Git Bash but not to work on the command line.
MY ISSUE:
Whenever I try to use my wp.phar in the native CLI I get a php error report - it does recognise the command and does show a list of suggestions (which is usually given when syntax is incomplete or incorrect).
How do I even start to figure this out?
1 - I've attempted to look for a git batch file in my Git Bash directory to see if I can find a dependency I'm missing but no dice.
2 - My Git Bash is now not recognizing the wp command and I now need to refer to wp.pharand then add any sub-commands/arguments after. However using the Git Bash CLI wp.phar doesn't cause errors
After a few months I found a solution.
Make sure that your PHP root folder path and the folder path containing your phar files are added to the Windows PATH Environment Variable (to allow us to just use the filename to refer to them).
CMD Line Options (Run as Administrator):
assoc .php=phpfile and assoc .phar=pharfile
Next is adding the program that opens this file. Adding an ftype command allows us to open .php/.phar files without using the php.
ftype pharfile=php.exe %1 %* (The %1 is a placeholder for the file called and %* refers to any other arguments that many be input).
FINALLY
The key issue was getting the .phar scripts to execute in the command line as windows ends up trying to open these files in it's Open With Dialog
So what I did was wrap my .phar in a batch file with this command (in the same folder as the phar
echo php "%~dp0wp-cli.phar" %* > [name of file].cmd
I then run this file as [name of file] with any arguments and it works as usual.
I have copied laravel project files into my wamp/www/test folder.
I have also downloaded composer.exe for windows
I have set my php variable
then when I execute the following command to get started, it does not work and says does not the term php
cd c://wamp/www/test
composer install
And here is what I have appended to the environment variable:
C:\wamp\bin\php\php5.3.13
What's wrong with it?
Did you restart your terminal after adding the path to your System Variables?
Or maybe you didn't use ; to separate the new path you added from the already existing ones.
My operating system is Windows 7.
I got my WAMP2.2 install in my computer.
Then I try to install PEAR.
However, I can not find my go-pear.bat file in my wamp directory.
Fine. I download in here: http://pear.php.net/go-pear.phar
and install using this file.
I put the file in
C:/wamp/bin/php/php5.3.8/pear/go-pear.phar
Run the command: php -d phar.require_hash=0 PEAR/go-pear.phar
After the installation, I include the path of pear in php.ini in php and apache folder.
I also include C:/wamp/bin/php/php5.3.8/ in windows $PATH variable.
But when I run pear command. It said it can not find the pear command.
I check the folder and just find a file called pear.bat and pear.ini.
I tried to run pear.bat again in command line. It still does not work.
Experts, please help on this issue.
Ok since many people may be asking the same thing. Let's suppose the following.
I'm currently running 2.2 E which includes Apache 2.2.22 – Mysql 5.5.24 – PHP 5.3.13 XDebug 2.1.2 XDC 1.5 PhpMyadmin 3.4.10.1 SQLBuddy 1.3.3 webGrind 1.0
Now, to install PEAR do the following:
Download this file:
http://pear.php.net/go-pear.phar
And put it on your WAMP server directory under the PHP version on the bin folder.
Run the command to install PEAR and you're over it.
Example (defaults, no change has been done)
Get the file on the link ->http://pear.php.net/go-pear.phar
Go to this directory C:\wamp\bin\php\php5.3.13
Open command prompt (cmd.exe). Supposing you're using Windows Vista and higher, press Start, type "cmd.exe" and right click on it and select run as administrator/CTRL+SHIFT+Enter (Haven't tested on non-priviliges rights)
Use Window's cd command to change the directory to the go-pear.phar file you've just downloaded. In my case I'll be pin pointing it to my own directory, so I did it like follows:
cd "C:\wamp\bin\php\php5.3.13"
Press Enter. You should note that instead of saying "C:\system\32" is now displaying C:\wamp\bin\php\php5.3.13
Write the following command and press Enter:
php -d phar.require_hash=0 go-pear.phar
Select whether you like or not a local copy or a system one. By typing system:local and pressing enter you'll install a local copy. By typing system and pressing enter you'll install a system-wide copy.
Type yes to confirm the option chosen.
The next list of directories, will be the referring directories that PEAR will install its components. If you select from 1 - 12 you can change the directory you'd like to install. By typing all and pressing Enter you'll be able to change them all in a queued manner. In my case, I just pressed Enter and left all defaults
DO THE FOLLOWING IN CASE YOU CONTINUE TO HAVE SOME LISTINGS
11. It is very probable that afterwards you'll receive a message like:
WARNING! The include+path defined in the currently used php.ini does not contain the PEAR PHP directory you just specified: If the specified directory is also not in the include_path used by your scripts, you will have problems getting any PEAR packages working.
Below it will also appear:
Would you like to alter php.ini ? [Y/n]:
Type y and press enter
This should put you running with PEAR on WAMP server :)
pear.bat is the executable on windows. You have to put that directory in your system's PATH variable for the command to be recognized.
All the steps mentioned to below link for GUI based - easy understanding review and setup:
Click here
For anyone looking for a more current answer. On Windows 10 I had to edit .bash_profile to add the following:
function __pear {
pear.bat $#
}
alias pear=__pear
I have use DB::Connect in my program for accessing the database.
I ran my php program this shows the error
DB.php file is not their.
require_once 'DB.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
Then I copy the DB.php file and PEAR.php file from another machine to my
machine after that If I ran from command line it didn't through the error.
while running from browser this shows error. How to solve this problem.?
How to install this DB.php?
PEAR provides a command line installer that should take care of all the details:
pear install DB
Since PEAR packages are mainly PHP code, you can also copy the files manually, but you must make sure you copy everything, not only the first required file, and your script must also be able to find the files so you must add pear to the include_path PHP directive.