Can't access localhost/laravel in LAMP - laravel

I'm new to Ubuntu 14.04 and I installed LAMP and I install laravel in /var/www but it seems that I can't access localhost/laravel in my server it says.
So what I'm missing here?
Edit:
It works when i try php artisan serve then it gives me localhost:8000 but when localhost/laravel it doesn't work.

It's because of your Apache is not working. You can start your Apache by the following command
sudo service apache2 start
You can see more about start/stop/restart Apache at here.
Or if you want to re install your lamp, so you can see at here

Related

laravel atymic/twitter is not running on linux server but working on macbook (homebrew)

I am facing a strange issue with Atymic Twitter
I have same version of php i.e. 7.4.22 on my local (macbook) and live server (ubuntu)
This is package running awesome on local but shows below error on server (ubuntu)
Details:
php 7.4.22
laravel :7.30.4
atymic/twitter 3.1.13
The apache process may still be using an other version of PHP. You can change that version using the following commands:
sudo a2dismod php7.2
sudo a2enmod php7.4
sudo service apache2 restart

localhost is unable to load application centos server

Trying to fire up a Laravel api and Nuxt app on the actual server by running
lets say server IP is - 10.66.22.41
npm run dev
php artisan serve --port=8001
This obviously worked on my local environment but since this is in the actual server and I am not too familiar with Centos, is there anything I should be doing different?
When I run npm run serve I get http://localhost:3001/
When I run php artisan serve --port=8001 i get http://127.0.0.1:8001
dumb question:
How should I be accessing this on the browser?
for Nuxt, added your script in package.json
"scripts": {
"dev:host": "nuxt --host 'IP-Address' --port 3001",
}
Run:
dev:host": "nuxt --host 'IP-Address' --port 3001
For Laravel:
php artisan serve --host=IP-Address --port=8001
Quick point though, What Khali should be the best practive but if you want to test or whatever you need to do , this is it.
Well, the artisan serve command, will keep the server running until you close the console, which will terminate the service! It is not an ideal setup... I would recommend that you install a webserver of some sort, and install laravel properly via composer. We cannot see how you installed NPM, or if you installed Apache? etc..
I would recommend to install centos webpanel for a starter:
http://centos-webpanel.com/
Then install composer https://linuxize.com/post/how-to-install-and-use-composer-on-centos-7/
Then install laravel using: https://laravel.com/docs/8.x/installation#installing-laravel
This is your best way to manage and run laravel on centos properly (for beginners), if you have the money for it, you should buy CPanel (https://cpanel.net/pricing/) instead of Centos WebPanel, as it offers more flexibility and features.
Good luck!

Laravel Migration Error :: PDOException, Could not find driver

I am trying to make a laravel and stucked when migration. when i enter php artisan migrate in terminal, showing PDOException error. attaching my screenshot of terminal and phpinfo.
What i sthis issue, How can i solve this,
I am using Xampp.
Anybody please help me.
Thanks
Try re-installing Xampp? You could use Laravel homestead for a virtual machine, it makes sure you have the proper PHP version and the required dependencies needed to install and avoids having to run Xampp or MAMP or WAMP or any of the amps.
It looks like Xampp cannot find: /usr/lib/php5/20121212/php_pdo_mysql.dll, so make sure that file exists.
You may need to re-install PHP PDO on your machine, refer to: http://php.net/manual/en/pdo.installation.php
Also per PHP docs:
PDO and all the major drivers ship with PHP as shared extensions, and
simply need to be activated by editing the php.ini file:
extension=php_pdo.dll
Please check you have installed more than one php version in your system, one is running for web server and another for php CLI, using PHP_INFO for web and php --ini in commandline, if different version found then upgrade or downgrade means make it one version configuration, and make sure PDO is enable in your system.
From php5.6 to php7.0:
Apache:
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php7.0
From php7.0 to php5.6:
Apache:
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php5.6

Laravel installed but confusion remains

I have ubuntu 14.04 and LAMPP is installed. I was learning Laravel 4, but get a lot of confusion on it's documentation, below I list few of issue.
How to install laravel?
what I did :
copy github repository into /opt/lampp/htdocs/larva and run composer install, Laravel is installed and I can access it with http://localhost/larva
What is homestead? is that another way to install laravel or this is additional thing?
What is artisan? if I use artisan then do we need to use homestead also?
what I did ( in terminal )
cd /opt/lampp/htdocs/larva
php artisan serve
it started the service and I can access laravel with htpp://localhost:8000 BUT if i close this terminal then URL is lost
and there is one other way is using vagrant? do we need to use vagrant if we installed it already?
one more thing is Nginx?
overall these vagrant, Nginx, Homestead, artisan,and composer methods create such a mess.
Please clear the clouds and please do not mention what is vagrant Nginx and all. I just want to know that do I need to do something with Homestead and vagrant if i have installed using git repository and composer way?
Thanks
Laravel Homestead is an official, pre-packaged Vagrant "box" that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine.
Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing your application. It is driven by the powerful Symfony Console component.
When you close the terminal, you are stopping the service on port 8000. You always can create a virtual host, and point its root to your larval installation /public directory
you dont have to use vagrant to run laravel. Vagrant is just your 'bridge' to Virtual Mashine.
If you installed LAravel via composer and you got it work on localhost:8000 then you dont need neither homestead or vagrant

Errors while installing Magento on Cent OS with Nginx and PHP-FPM

I have been fighting this for hours now and finally found a resolution so I wanted to share it with anyone else who has trouble.
If you receive the following errors while installing Magento on Linux while running Nginx and PHP-FPM then try the answer below:
PHP extension "dom" must be loaded.
PHP extension "mcrypt" must be loaded.
PHP extension "gd" must be loaded.
Try running:
yum install php-xml php-gd php-mcrypt
I was wondering why this wasn't working and I was dumbfounded for hours.
The trick is to restart php-fpm once you have everything installed. I kept restarting Nginx.
Run the following:
service php-fpm restart
Hope this helps someone!

Resources