Cannot use port 80 on Mac - php

I'm using macOS Catalina version 10.15. At the beginning, I was able to use MAMP PRO with Port 80. However, after I failed to run composer install inside a project at /applications/mamp/htdocts/project/ because of a missing extension ext-zip of PHP as below:
Problem 1
- Installation request for phpoffice/phpspreadsheet 1.10.0 -> satisfiable by phpoffice/phpspreadsheet[1.10.0].
- phpoffice/phpspreadsheet 1.10.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
Problem 2
- phpoffice/phpspreadsheet 1.10.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- maatwebsite/excel 3.1.17 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.10.0].
- Installation request for maatwebsite/excel 3.1.17 -> satisfiable by maatwebsite/excel[3.1.17].
I decided to install php via homebrew in Terminal. After successfully installed by the following commmand
brew install php#7.3
# php -v
PHP 7.3.8 (cli) (built: Aug 24 2019 19:38:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies
#which php
/usr/bin/php
As a result, I cannot use MAMP PRO with Port 80 anymore nor does it resolve the missing extension ext-zip problem.
I have a couple questions that cannot wrap my head around:
If the built-in php has been always there, how could I use the Port 80 in the beginning?
is the built-in php with macOS always running? How to know inside of a project that which php is being used? (macOS or MAMP)??
What I have tried:
- Attempt to uninstall php version that I have installed by brew uninstall php#7.3 --force.

Ports from 1 to 1024 cannot be used by normal users without root credentials.
You would be able to use sudo to bind to port 80, but be aware, there could be some security risks when starting a program with root credentials, so use a wrapper which binds to your privileged port and relaxes the user credentials to a normal user.

Related

Composer can't install phpoffice/phpspreadsheet on windows

i tried installing phpoffice/phpspreadsheet(im using windows) but i receive some errors, i'm on organization VPN( idk if this may be the problem but i know this was relevant for installing composer)
i tried those commands
php --version
PHP 8.2.0 (cli) (built: Dec 6 2022 15:31:23) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies
composer -V
Composer version 2.5.4 2023-02-15 13:10:06
composer require phpoffice/phpspreadsheet
Cannot use phpoffice/phpspreadsheet's latest version 1.27.1 as it requires ext-gd * which is missing from your platform.
Installation failed, deleting ./composer.json.
In RequireCommand.php line 225:
No composer.json present in the current directory (./composer.json), this may be the cause of the following excepti
on.
In PackageDiscoveryTrait.php line 317:
Package phpoffice/phpspreadsheet has requirements incompatible with your PHP version, PHP extensions and Composer v
ersion:
- phpoffice/phpspreadsheet 1.27.1 requires ext-gd * but it is not present.
- phpoffice/phpspreadsheet 1.27.1 requires ext-zip * but it is not present.

(Solved) Laravel New Installation - Removing PHP 7.1.23 from Mac without Brew

Solution: I've updated my OS to the latest version where the latest PHP was supported.
I've got a new laravel project
When I run php artisan serve
it shows:
MacBook-Pro% php artisan serve
Warning: require(/Users/username/Desktop/code/argon/vendor/autoload.php): failed to open stream: No such file or directory in /Users/username/Desktop/code/argon/artisan on line 18
Fatal error: require(): Failed opening required '/Users/username/Desktop/code/argon/vendor/autoload.php' (include_path='.:') in /Users/username/Desktop/code/argon/artisan on line 18
composer update shows
MacBook-Pro% composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ^7.2.5 but your PHP version (7.1.23) does not satisfy that requirement.
Problem 2
- laravel/tinker v2.2.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/tinker v2.1.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/tinker v2.0.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/tinker 2.x-dev requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- Installation request for laravel/tinker ^2.0 -> satisfiable by laravel/tinker[2.x-dev, v2.0.0, v2.1.0, v2.2.0].
MacBook-Pro% php -v
PHP 7.1.23 (cli) (built: Nov 7 2018 18:20:35) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
also
MacBook-Pro% brew unlink php#7.1
Error: No such keg: /usr/local/Cellar/php#7.1
MacBook-Pro% brew unlink php71
Error: No such keg: /usr/local/Cellar/php71
also
MacBook-Pro% which php
/usr/bin/php
Any ideas how to remove php 7.1.23 ?
php -v gives the following response:
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
The release notes for Catalina contain the following remark:
Info here
Scripting Language Runtimes Deprecations Scripting language runtimes
such as Python, Ruby, and Perl are included in macOS for compatibility
with legacy software. Future versions of macOS won’t include scripting
language runtimes by default, and might require you to install
additional packages. If your software depends on scripting languages,
it’s recommended that you bundle the runtime within the app.
In short: macOS continues to include 'legacy' versions of things like Python, Ruby, Perl, and indeed PHP, so that existing code won't break, but Apple is leaving it to the user to install the versions that they want to use.
Found a solution !
brew install php72
brew switch php#7.2 7.2.25
https://laravel.com/docs/6.x/homestead

Installing gearman PHP extension on Windows using cygwin and pecl

There is only a handful of threads on installing gearman on Windows, especially the gearman PHP extension. I have not found a solution yet. If anyone found a solution to get gearman PHP extension working on Windows, please comment on this thread.
I came across this thread on pecl install gearman. When attempting to install Gearman PHP extension through cygwin using pecl, the installation failed with the following error.
$ pecl search gearman
Retrieving data...0%
Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
gearman 1.1.2 (stable) PHP wrapper to libgearman
$ pecl install gearman
pecl/gearman requires PHP (version >= 5.1.0, version <= 6.0.0, excluded versions: 6.0.0), installed version is 7.1.12
No valid packages found
install failed
I checked PHP version and it is 5.6.3. Where is that installed version 7.1.12 coming from?
$ php -v
PHP 5.6.31 (cli) (built: Jul 5 2017 22:24:51)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Related thread: How can i install gearman php extension on Windows OS?

composer install issues

When i'm trying to install composer
i got following error.Actually all modules are installed.
As per my knowledge there will be two configuration files(apache2 & cli).
in both of the configuration files modules are enabled.still I'm facing this issue.
Problem 1
- The requested PHP extension ext-gd * is missing from your system.
Problem 2
- The requested PHP extension ext-mcrypt * is missing from your system.
Problem 3
- The requested PHP extension ext-curl * is missing from your system.
Problem 4
- The requested PHP extension ext-intl * is missing from your system.
Problem 5
- The requested PHP extension ext-xsl * is missing from your system.
Problem 6
- The requested PHP extension ext-mbstring * is missing from your system.
Problem 7
- Installation request for braintree/braintree_php 2.39.0 -> satisfiable by braintree/braintree_php[2.39.0].
- braintree/braintree_php 2.39.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
Problem 8
- Installation request for pelago/emogrifier v0.1.1 -> satisfiable by pelago/emogrifier[v0.1.1].
- pelago/emogrifier v0.1.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
when i'm trying to update/install
sudo apt-get install php5-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-curl is already the newest version.
The following packages were automatically installed and are no longer required:
linux-headers-3.13.0-46 linux-headers-3.13.0-46-generic
linux-image-3.13.0-46-generic linux-image-extra-3.13.0-46-generic
sendmail-base sendmail-cf sensible-mda
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.
update:
php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-zts-20121212/php_mbstring.dll' - /usr/lib/php/extensions/no-debug-zts-20121212/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-zts-20121212/php_mbstring.dll' - /usr/lib/php/extensions/no-debug-zts-20121212/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.5.9 (cli) (built: Sep 8 2015 18:01:37)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
Try using php -m to make sure the modules have been enabled in your php installation.
If they are not in the list, you will have to add them in your php.ini.

can't create a Laravel project because mcrypt extension is missing

OK, I have seen many posts about this, and I have spent the entire day working through them to solve this issue, with no success.
I am trying to create a Laravel project. I am using a Mac (Yosemite), which is running PHP 5.5.14. There is also an older version of PHP on the machine. When I try to create a project from the command line using "laravel new projectname", no errors are reported, but the command just creates an empty folder named with the project name. I get the "Crafting application..." and "Application ready! Build something amazing" messages but, again, only an empty folder.
If I try to use this command:
composer create-project laravel/laravel projectname
I get this:
Installing laravel/laravel (v5.0.16)
- Installing laravel/laravel (v5.0.16)
Downloading: 100%
Created project in projectname
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for laravel/framework v5.0.16 -> satisfiable by laravel/framework[v5.0.16].
- laravel/framework v5.0.16 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
In the terminal, if I enter this:
which php
I get: /usr/bin/php
/usr/bin/php -v
I get:
PHP 5.5.14 (cli) (built: Sep 9 2014 19:09:25)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
I used homebrew to install autoconf and mcrypt with this command:
brew install autoconf mcrypt
If I run that command again, I get:
Warning: autoconf-2.69 already installed
Warning: mcrypt-2.6.8 already installed
Since I kept getting the error, I assumed it was installed in the wrong place so, I compiled and installed mcrypt myself using these instructions:
[Install mcrypt php extension][1]. I used PHP version 5.5.14 during the install. Mcrypt was installed in this directory: /usr/lib/php/extensions/no-debug-non-zts-20121212/
I have restarted Apache. I have checked my .bash_profile to make sure /usr/bin is in my Path.
If I create a page with phpinfo() and view it in my browser, I see that mcrypt is listed in the "Module Authors" section of the page. It just lists the names of the people who created the module.
I am stumped. I look forward to any suggestions that people might offer (I really don't want to install a virtual box, or anything like that. Surely, I can get this module installed in the right place!)
Thanks very much!
I got this exact same problem too.
You have to find php.ini for php cli and add extension=mcrypt.so
My system is running LAMPP server with preinstalled PHP. So, here's what I do:
Install mcrypt extension
I tried both:
sudo apt-get install mcrypt
sudo apt-get install php5-mcrypt
Configure php.ini for CLI
Then, edit php.ini located in /opt/lampp/etc/php5/cli/php.ini add extension=mcrypt.so on Dynamic Extension section (anywhere is fine I think). Don't forget to restart your server.
Try using composer to install laravel
Now, you can run whatever method you want to install laravel. I download Laravel 5 manually, unzip, then install using composer install command. I think your command composer create-project laravel/laravel projectname would've run smoothly too.
References:
here
mac users install brew and then enter
brew install php56-mcrypt
in terminal
EDIT
if you get any error using above line then try this command
brew install homebrew/php/php56-mcrypt
Please following the step :
cd /etc/php5/cli/conf.d
ln -s ../../mods-available/mcrypt.ini 20-mcrypt.ini
Worked for me.
For MAC users,
brew install homebrew/php/php56-mcrypt

Categories