I am attempting to install phpspreadsheet via composer on my Mac running macOS 10.15. I know that this version of macOS doesn't have the php zip extension so composer isn't installing the library.
The thing is, the library is going to wind up on a server that does have the zip extension. So, I really don't need for the zip extension to be on my Mac. I just need the library installed so I can upload the vendor folder to the server.
How can I get composer to install it and ignore the extension check? I don't have access to a shell on the server the site runs on so I can't install directly there.
You use the option --ignore-platform-reqs.
Be aware that the zip extension is also directly used for installation. If that fails, Composer will try to install the deps by cloning the repositories, but you would need to at least have git installed on the dev machine.
The docs.
Related
I want to use mongodb in laravel project. so I tried to install mongodb driver for php by running this command pecl install mongodb on cmd but I got this answer
No releases available for package "pecl.php.net/mongodb"
install failed
what should I do?
If you are on a windows machine, go to the official pecl website:
https://pecl.php.net/package/mongodb
then click on the DLL link for your version of choice.
On next page scroll down and download the one matching your PHP version.
Then you should extract the zip file and copy the php_mongodb.dll to your php/ext dir. Then open your php.ini and add the following line:
extension=php_mongodb.dll
This happened to me because for some minutes, the PECL repositories were not accessible. The error was happening both on CI an my local (both on Linux) and after some minutes, it got fixed without any action from my side.
I was also facing the same problem. You can just write the following line in your command line(This will work on Mac):
$ sudo pecl install mongodb
I want to invoke the stats_rand_gen_exponential() function but apparently to do so I need to install the Statistics extension.
How do I install extensions using Composer?
UPDATE
I cannot understand what could possibly be wrong.
PHP extensions can't be installed using Composer. You can require them, but all that does is tell Composer that they need them to run, so that they will fail explicitly when someone installs the dependencies for your package. See https://getcomposer.org/doc/01-basic-usage.md#platform-packages for details.
There are a number of ways to install PHP extensions and the best will often depend on your platform. On Linux, there may be packages available for that extension via your package manager, and if so that's the easiest method. PECL looks to be the recommended installation method for this extension, so that would be my second choice if it's not available via a package manager. Or if you're using phpbrew you can probably use phpbrew ext install to install the extension you need.
I am trying to get my head around how to install composer. Really confusing!
I have downloaded the windows installer and during the installation was asked to locate "php.exe". Does that mean I need to have a local server (Wamp) installed?
Lets say I manage to install composer on my PC. How do I get it to work on my web host? Do i copy files there or do I need to install composer on web host as well?
Composer requires php executable, but not webserver. So installing php from php site is sufficient. However, if you plan to develop or run php applications on your computer, you would prefer to install full stack (eg wamp) right away.
Composer is needed only to install and update dependencies, once you do it, all are just files, and you transfer them as you transfer other files to your webhost. So copy, no need to install composer on web host.
I am trying to install phpdbg on OS X. The docs say to cd to /usr/src ... I don't have that directory. What normally goes in /usr/src/php-src/sapi? The php source? If so, where can I find the equivalent directory on OS X? I can't find a php-src directory using finder.
From the docs:
Installation To install phpdbg, you must compile the source against
your PHP installation sources, and enable the SAPI with the configure
command.
cd /usr/src/php-src/sapi
git clone https://github.com/krakjoe/phpdbg
...
In the docs, the directory /usr/src/php-src is used as a sample location to indicate the source directory the copy of PHP compiled on your system. Instead, use the directory containing the source for your local PHP install.
If you installed PHP through a package manager instead of compiling it yourself, find the corresponding source package in the package manager, install the source package, and use the directory it installed to instead of /usr/src/php-src.
You will also need to use the same compiler and toolchain used by the upstream package manager.
If you use homebrew, it's easy.
With PHP 5.6, I think it's included by default. I haven't upgraded from PHP 5.5, yet.
I already had php55 installed (substitute install for reinstall if this is a new install).
brew reinstall php55 --with-phpdbg
(This is reported to work for PHP 5.4 too. I haven't tried it.)
I want to install PEAR on PHP 5, so I can use Spreadsheet_Excel_Writer.
I don`t know how to install it on my ISP nor my personal MacBook.
Thoughts for both?
The PEAR Manual has a quite extensive list of instructions on how to install the PEAR manager on Windows, *NIX and Mac OS X. The manual also has a section on installing PEAR remotely, for example using FTP. Following those instructions, you should be able to install PEAR (nearly) anywhere. :)
From the command line, do this:
pear install Spreadsheet_Excel_Writer
You can also download the package directly here without using PEAR: http://download.pear.php.net/package/Spreadsheet_Excel_Writer-0.9.1.tgz. It's pretty easy to use if you have the script located anywhere within your include path.
For your personal computer, using the "pear" script that ships with most PHP distributions is a good idea.
For shared hosting, you can
Track your dependencies manually, and copy all the appropriate files to the server yourself
With pear installed, do "pear install -R/my/root_dir -a Spreadsheet_Excel_Writer". This will install the package and all dependencies to the specified root directory. Copy this installation to your webhost.
You should also have a look at "pear help" and "pear help install".
You can't install pear to your isp's core. But you can install the individual files from pear's site and upload them to your host:
http://pear.php.net/package/Spreadsheet_Excel_Writer/download