0

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

Martin Christopher
  • 389
  • 1
  • 7
  • 21
  • **but instead i got show a coding from /var/www/html/project/public/index.php**, isnt `public/index.php` the entry point for laravel? what is this "show a coding" that you see, an error message, or plain php code? do the url always contains `index.php` on address bar (solved with installing apache `mod_rewrite`)? do you have php installed properly (it should be as long as your phpmyadmin runs fine)? do you have configured the `.env` file? is the dependecies installed in `vendor` folder already (solved through [`composer update`](https://getcomposer.org/doc/03-cli.md#update-u))? – Bagus Tesa Jan 31 '20 at 02:34
  • @BagusTesa yes ```/public/index.php``` one of entry point for laravel, what i meant showing coding is literally plain php. My ubuntu server was on separate computer. When i entered the ip address of that computer like ```192.168.0.5``` it run `/public/index.php``` but literally plain php. i did check my php using ```php -v``` and it show 7.x.x. and i did download the vendor via ```composer install``` and updated it using ```composer update``` and ```sudo cp /var/www/html/project/.env.example /var/www/html/project/.env``` and update it. – Martin Christopher Jan 31 '20 at 03:22
  • it seems the `index.php` is served as plain text, your php havent loaded into the apache. could you check on `httpd.conf` for anything that says php? in the past, to make life easier, i just slap in LAMPP stack instead of installing them manually.. – Bagus Tesa Jan 31 '20 at 03:26
  • My apache2 doesn’t come with ```httpd.conf``` like stated on the link but i searched and everything built in on ```apache2.conf```. But either way what am i looking for? And I’m installing my mysql using ```sudo apt-get install mysql-server``` is it any different? – Martin Christopher Jan 31 '20 at 05:30
  • no, no, its unrelated to mysql server. i just doing checklist based on previous [QA](https://stackoverflow.com/a/5121589/4648586). based on your comment on the answer below, it seems php only not executed on your laravel folder. do you have `` definition for the public folder, beside the `` thing? – Bagus Tesa Jan 31 '20 at 05:46
  • I’m not really sure what do you mean by `````` but I don’t think there’s – Martin Christopher Jan 31 '20 at 10:01

2 Answers2

0

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.

0

change .dev to .qa

google chrome update prohibits to use .dev locally.

Syed Abdur Rehman Kazmi
  • 1,640
  • 3
  • 13
  • 30