laravel won't run on ubuntu server - laravel

this is my first time using ubuntu server and i want to give it a try. I already did the apache2, mysql, phpmyadmin install, and VirtualHost setup. And I already download my program from github on /var/www/html/project/. Usually when I run redirect my VirtualHost to /var/www/html/project/public laravel would automatically start, but instead i got show a coding from /var/www/html/project/public/index.php. What did i do wrong?
to setup VirtualHost first I type sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/project.dev.conf and type this code
<VirtualHost *:80>
ServerName project.dev
ServerAdmin project#dev.com
DocumentRoot /var/www/html/project/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/custom.log combined
</VirtualHost>
and then on terminal I typed sudo a2ensite project.dev.conf then restart sudo systemctl reload apache2
I followed this link https://help.ubuntu.com/lts/serverguide/httpd.html

As you had listed you had already installed the apache2, mysql, phpmyadmin. According to me you are not installing the php on your ubuntu server. Try for checking the
<?php echo phpinfo(); ?>
If not then you can install by the following command:
sudo apt-get install php7.2 php7.2-cli php7.2-common
And by following command you can download the most commonly used php extensions:
sudo apt-get install php7.2-curl php7.2-gd php7.2-json php7.2-mbstring php7.2-intl php7.2-mysql php7.2-xml php7.2-zip
After that you can install and setup the firewall for security purpose. And don't forget to protect your phpmyadmin page from direct opening.

change .dev to .qa
google chrome update prohibits to use .dev locally.

Related

phpmyadmin 500 Internal Server Error after sudo a2enmod rewrite

I configure my server for Laravel app with the composer. this is installation process:
apache2
PHP
MariaDB
phpmyadmin
until here the phpmyadmin works. but after Laravel installation and specially using sudo a2enmod rewrite for registering VirtualHost, I get the 500 internal server error on phpmyadmin. whats the problem?
First, you need to check error here the : nano /var/log/apache2/error.log
In my Case Error was .htaccess: Invalid command 'Header', perhaps misspelled
Solution :
sudo a2enmod headers
/etc/init.d/apache2 restart

How to enable php-Mcrypt extension in Laravel Homestead

I am trying to get an old Laravel 4.1.x app up and running again so that it can be modernized. This requires an environment with PHP 5.6 and the Mcrypt extension. I have installed Homestead 9.0.3 (the latest stable version). Within the VM, I have set the PHP version to 5.6
sudo update-alternatives --config php
I have then installed the php-mcrypt extension
sudo apt-get install php5.6-mcrypt
I am now able to create a new Laravel 4.1.x project, which is a process that requires Mcrypt to complete, so we're certainly getting somewhere:
composer create-project laravel/laravel="4.1.*" myAppName
However, when I browse to the webpage for myAppName, I see the message:
Mcrypt PHP extension required.
I have also tried steps that are usually recommended for this problem, ie:
sudo ln -s /etc/php/5.6/conf.d/mcrypt.ini /etc/php/5.6/mods-available/mcrypt.ini
sudo phpenmod mcrypt
sudo service php5.6-fpm restart
But I still get the same message in the browser.
What step have I missed?
With homestead v9 you should be up and running with php5.6 out of the box as stated in
here, but unfortunately it is not your case, and I understand that...
Old packages were not installed by default (php5.6-mcrypt), as you mentioned and they should be added by hand via:
sudo apt-get install php5.6-mcrypt
After that all packages are ready, up and working, especially php5.6-mcrypt.
The root of your problem is in multiple site definitions under your homestead.yaml.
Most probably some of them are overlapping and your nginx is referring to the wrong resource/site_definition, and wrong paths.
Therefore you might think some strange php versions or routes are run/executed.
You can verify that, by deleting some/all of them, leaving the only one important for you - in (/etc/nginx/sites-enabled/...).
Of course please do that inside the container and issue sudo service nginx restart, afterwards...
All of your problems should be gone after that.
If something goes wrong. You could easily recover your current installation to current state using vagrant destroy and vagrant up afterwards, cause all is saved in Homestead.yaml.
In my installation Homestead v9 is running with php5.6 on laravel 4.1 without any problems...
Hope it helps #jsm...
Because all the PHP versions installed on homestead you need to set the PHP version for a site in the Homestead.yaml.
First check what version the server is running with phpinfo();
Check the file /etc/nginx/sites-enabled/homestead.test and look for this line:
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
If you didn't set the php version on the sites list, this file will be pointing to the php7.3.sock.
In this case the version 5.6 has mcrypt installed, but 7.3 don't.
You can just replace the line
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
for
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
and then reload nginx with sudo nginx -s reload.
Or set the php version on Homestead.yaml:
sites:
- map: homestead.test
to: /home/vagrant/code/public
php: "5.6"
And then run vagrant provision, it will change the nginx configuration for PHP 5.6.

Laravel valet It works

I'm trying to install Laravel valet but I keep getting (when I visit domain.dev):
It works!
I already tried a lot. For example:
remove valet
stop apache (apachectl stop)
composer global require laravel/valet
valet install
valet restart
But that does not work for me. I've also installed Laravel Homestead in a vagrant box. Perhaps that has something to do with it? I can visit my Homestead sites.
How can I fix this problem?
"It works!" will always be a message from Apache.
Apache has to be turned off for Laravel Valet to work.
I see you have tried these before:
$ stop apache (apachectl stop)
$ sudo apachectl -k stop
I had the same problem. Try with the command below and then after be sure to restart valet again! This fixed it for me:
$ sudo apachectl stop
$ valet restart
So many different combinations of what to do here
Here is what worked for me.
Turn off other local Apache altogether
sudo apachectl -k stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Remove the Valet directory altogether
rm -r ~/.valet
Removed Valet via composer globally
composer global remove laravel/valet
Re-install via composer
composer global require laravel/valet
Install Valet
valet install
Go to Folder to Add directories
cd ~/Sites/
Then add projects to park
valet park
Change Valet domains to something else to stop urls forcing to https://
valet domain app
Change directory into the project folder
cd ./laravel-project/
Then open current project
valet open
The browser should open to http://laravel-project.app
No need to stop Apache, and it doesn't have anything to do with Homestead.
The answers provided solve your problem but they are not good.
You can simply run
valet port 8888
(or whatever port you want) and get your site on domain.dev:8888
The point is not that Apache and Nginx don't like each other, they are agnostic of each other, just keep them listening on different ports.

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

Setting up PHPMyAdmin on Amazon EC2

I've installed PHPMyAdmin on my Amazon EC2 instance using the following:
yum --enablerepo=epel install phpmyadmin
Then symlinked it to /var/www/html with
ln -s /usr/share/phpmyadmin /var/www/html
When I navigate to /phpmyadmin in my browser, it gives me a 403 Forbidden saying I can't access /phpmyadmin/ on the server.
Thanks for any help.
from here you should edit phpMyAdmin.conf to allow the access

Resources