I'm new to Mac Environment. My colleague recently gave me a Laravel project that I had to work on with a new cosmetic changes.
Like usual I get all the files and do the typical things like git the project, install composer, install npm, database setup, .env file setup and run the project.
I can open the project on the landing page. But what happened was, when I tried to sign in, I failed to enter the homepage. When I check the console it says: View error Message
POST http://localhost/aplikasi-laravel/MY/user/login 500 (Internal Server Error) Jquery-3.1.1.min.js: 4
Request URL: http://localhost/aplikasi-laravel/MY/user/login
Request Method: POST
Status Code: 500 Internal Server Error
Remote Address: [::1]:80
Referrer Policy: no-referrer-when-downgrade
For your information, if I install and create a new Laravel project on this OS, it works. But I need to work on this project. So I have no choice.
My Project Specifications are as below.
Laravel: Laravel Framework 5.4.36
PHP: 7.1.28
MySQL: 5.7.26
So what I'm doing is I install MAMP, downgrade to PHP 7.1.31 (only this php version is available), try running the project. Still failed. So I uninstalled it.
I tried using homebrew and XAMPP, and still failed.
My OS is Mac OS Catalina.
Because I wasting so may time setting up the environment on the mac, I'm try to use my PC with Windows 10 installed. So here's my setup.
Platform: XAMPP
PHP: 7.1.28
With the same code and setup, I was able to run smoothly without any errors on Windows 10. So I think it shouldn't be a code problem (maybe).
Since I need to work with the Mac OS environment, I want someone to help me to give an idea on how to solve this problem. Thanks.
Related
So, my company is using PHP with Laravel for software development for clients. I am new to the company and setting up a newer Macbook with VirtualBox, Laravel using Homestead, and Vagrant.
I have gotten everything set up to be able to create local files and have them also tie into the VM, but anytime we try to open the pages using our local host, it gives us the error that "Laravel requires the Mcrypt PHP extension".
I have migrated all of our in-house files over to my local machine to be able to open them locally, but I can't get them to open even with being able to see them in the terminal. It works fine on the other developer's Macbook, although he is using an older version of both PHP and Laravel.
My question, which I cannot find a relevant question about, is can I install an older version of laravel and PHP to be able to force my VM project to open only with PHP version 7.0? I found some posts that indicate that mcrypt is no longer supported on PHP 7.1+.
Please include any relevant information you know of. We have been beating our heads against this issue all day yesterday and today. I'm sorry if this post seems noob-ish. I'm just not figuring it out.
***EDIT:
We got it figured out today. We had to force our project into PHP 7.0 and finally got it working. We deleted the entire original Laravel installation and reinstalled using this tutorial: https://medium.com/#gdiasdasilva/creating-a-homestead-box-with-php-7-0-aaa72fb0e297
Thank you guys for your responses. Thankfully after two days, we worked our way through the issue. The biggest issue was trying to allow the project, which was created on another machine using a different version of PHP, to open and run on my machine. Not an issue I had seen anywhere before. To be fair, this is my first time ever working with Laravel. I have a background in ASP.NET MVC 5 and this is an adjustment on getting the correct dependencies.
Again, thank you all for your responses!***
You can specify the PHP version in the Homestead.yaml file:
sites:
- map: homestead.test
to: /home/vagrant/code/Laravel/public
php: "7.0"
After making this change you will need to re-provision Homestead:
vagrant reload --provision
See the Multiple PHP Versions section from the documentation.
I am new to PHP and Laravel.
I installed Laravel and Composer , created new project and it is working fine.
Now when i tried to migrate a database using this command php artisan migrate i got errors, i wonder is it something related to not installing Xampp ? i am running Mac OS
The errors i got is
1 PDOException::("SQLSTATE[HY000] [2002] Connection refused")
/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=app", "root", "", [])
/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
Xampp has nothing to do with Laravel itself. Xampp is a set of tools that is usually used together to deliver websites. Xampp just makes it easier (supposedly) to install those set for you. Rather than having to install and setup all yourself.
Today people tend to avoid such sets in favour for tools like Vagrant or Docker.
Laravel even provides its own Vagrant setup called Homestead.
See ie. in Laravel 5.5 docs: https://laravel.com/docs/5.5/homestead
If you don't want to use Homestead but build your own server environment there's also tools to make this easier for you.
For example there is http://www.puphpet.com for PHP + Vagrant and https://phpdocker.io/ for PHP + Docker.
Xampp is not required but a php server like apache or nginx is required also in order to use mysql you should have mysql installed you get this error
PDOException::("SQLSTATE[HY000] [2002] Connection refused")
/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
because the mysql service is turned off so I think you open Xampp control Panel and you start mysql in order for it to work and this is why you have asked if Xampp is required am I right !!!
Actually to prove that Xampp has nothing to do with Laravel you can start the mysql server from command line I will give you example in windows OS.
if you have xampp installed on C:/ Driver lets say then try cd(change directory) into this path in your command line
cd c:/xampp/mysql/bin
start mysqld.exe // this will start the mysql service for you
now you can navigate to your Laravel app and try to migrate this time you won't get connection refused error and that is because you have started the Mysql server from command line.
I think this proves that Xampp has nothing to do with Laravel.
Hope this was helpful, good luck.
Mac OS comes with PHP built into it. You should be able to use php -v to see what version. Use php -S localhost:xxxx to output the local directory to a local address.
For example, to run laravel locally, open the terminal cmd+spacebar, type terminal, open it, then use change to the path where your laravel project is.
Type php -S localhost:3000 and it should give you a confirmation in the terminal. Now open a browser and go to localhost:3000 and it should show your project.
I was using Laravel 5.2 on windows 7/Wamp 3.0.6 perfectly fine. My company upgraded to Windows 10 and now localhost:8000 just hangs, and does not load anything. Still using Wamp 3.0.6 on windows 10.
I did a clean install of 5.2 as well as cloning my repo, and they both hang at localhost:8000.
I did a clean install of 5.3 as well as 5.5, and they both seem to work fine. (Does not hang at localhost:8000. It shows the Laravel welcome page)
Has anyone gotten laravel 5.2 to work with windows 10?
192..168.0.1 was being blocked at my firewall level, I have to specify host to be 127.0.0.1. Strange
I installed homestead using virtual box on my windows 10. Everything works really neat, plus homestead also has most configurations preset for laravel, as they belong together (as far as I know)
My setup of Laravel 5.2 is working fine on windows 10. There might be other issues. Please check the laravel error logs, Php error logs and Apache access and error logs to figure-out actual problem.
You can post these error logs here so we can help you out with the issue.
In the MAMP menu bar>> Tools - I am seeing this:
phpMyAdmin(needs PHP5.5x to 7.0x)
SQLite Manager (needs PHP5.2.x or 5.3.x)
I have 8 sites on one shared database developed locally using MAMP. Never had a problem in the past. I cannot access any of the sites via localhost. - the last site I worked on required a newer version of PHP and I added V7.1.1 - the prior sites are run on earlier PHP versions, built full site using php 7.1.1 locally no problem. - That said, currently
none of the sites will open via localhost.
The only thing I can think of is that I may have upgraded to OS Sierra and maybe that threw off a file? I called Apple they recommend not touching the Apache settings. I reinstalled Mamp, no change.
OS Sierra 10.12.3
MAMP V.4.1.1
PHP V. 7.1.1
I can connect to the internet, and my firewall is off.
I checked my host file - everything is there that should be with the exception of : "sudo killall -HUP mDNSResponder" which I read in an earlier thread - do I need this?
localhost connection message:
"Unable to connect
Firefox can’t establish a connection to the server at localhost:8888."
I thought that by downloading the lastest version of MAMP I would be recieving the latest package of software such as apache,mysqyl and phpMyAdmin?
I humbly ask for any insight and thank you in advance!
I'm having this same issue and just found this on google:
After you run the servers on MAMP/MAMP PRO
TRY THIS:
localhost:8888/phpmyadmin
I upgraded my mamp installation from 3.5 to 4.0.6 (renamed existing MAMP to MAMP-old). Running any website on localhost will not load. Have performed the following:
first migration to new MAMP I copied the db folder to the new mamp and set all the proper ports (3306 and 80). Ran localhost/website and blank white page.
then reinstalled new version of MAMP and manually created needed databases and insured database user was added. Ran localhost/website and blank white page.
If I go back to previous install of MAMP (3.5) everything works fine. I have performed several MAMP upgrades in the past without issue. So not sure why this upgrade is not working.
I am running on MAC Sierra. No other 3rd part tools involved. Working version of MAMP uses PHP 5.6.10. New version of MAMP using PHP 5.6.27.
When localhost/website will not run, checking safari developer console shows failed to load the resource: server responded with a status of 500 (internal server error). Verified document root is set properly.
Any suggestions for uncovering the problem would be most appreciated.