Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Atef95's avatar

HTTP ERROR 500

Hey artisans

I'm trying to host my project on a VPS UBUNTU 16.04

I'm running into an issue from hours and couldn't fix it

whenever I try to access

mprojectfolder/public

I get HTTP ERROR 500 ( from apache)

what I did for TEST PURPOSES :

set following folders to 777 permissions :

  • Main Folder

  • /storage

  • /bootstrap

I keep getting the same error..

PHP VERSION : PHP 7.2.33-1+ubuntu16.04.1+deb.sury.org+1

is there anything else I can do please ?

0 likes
16 replies
Sinnbeck's avatar

You should never point your virtual host file to the root of the project. Point it to the public folder.

Can you show your apache virtual host file? It should be stored at something like

/etc/apache2/sites-available/name.conf

It should be something like

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /path/to/project/public
    DirectoryIndex index.php

  <Directory "/path/to/project/public">
      AllowOverride All
      Options +FollowSymLinks +Indexes
      Order allow,deny
      Allow from all
  </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
Atef95's avatar

@sinnbeck

I just did that for test purposes

This is the actual configuration

<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName admin.thejourney.space
        ServerAlias www.admin.thejourney.space
        DocumentRoot /var/www/html/journey/public

        <Directory /var/www/html/journey/public>
                        Options Indexes FollowSymLinks
                        AllowOverride All
                        Require all granted
         </Directory>


        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

You can check through this link below

Sinnbeck's avatar

@laracoft Hard to tell without seeing the virtual host file. Perhaps it isnt set up to point to the project at all?

Atef95's avatar

@laracoft

I did that

I've checked also storage/logs/ folder and it's empty

laracoft's avatar

@atef95 read carefully, not storage/logs, /var/logs/apache2/error.log, or somewhere inside your /var/log folder

Sinnbeck's avatar

@atef95 Try setting a directory index in the Virtual host file (remember to reload apache)

DocumentRoot /var/www/html/journey/public
DirectoryIndex index.php
Atef95's avatar

@sinnbeck

[Fri Sep 25 13:47:52.664796 2020] [core:notice] [pid 9535] AH00094: Command line: '/usr/sbin/apache2'
[Fri Sep 25 13:47:55.877335 2020] [:error] [pid 9540] [client 197.2.169.79:13936] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/ma$
[Fri Sep 25 13:48:02.123277 2020] [:error] [pid 9544] [client 31.13.115.2:42356] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/mar$
[Fri Sep 25 13:48:02.660287 2020] [:error] [pid 9541] [client 31.13.115.4:32806] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/mar$
[Fri Sep 25 13:48:03.096864 2020] [:error] [pid 9546] [client 31.13.115.18:54048] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/ma$
[Fri Sep 25 13:48:04.461409 2020] [:error] [pid 9547] [client 31.13.115.14:59820] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/ma$
[Fri Sep 25 13:48:04.467179 2020] [:error] [pid 9540] [client 31.13.115.2:51708] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/mar$
[Fri Sep 25 13:48:40.540811 2020] [:error] [pid 9544] [client 197.2.169.79:13941] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/ma$
[Fri Sep 25 13:48:42.322890 2020] [:error] [pid 9551] [client 197.2.169.79:13943] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/ma$
[Fri Sep 25 13:48:43.467009 2020] [:error] [pid 9541] [client 197.2.169.79:13944] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/ma$
[Fri Sep 25 13:48:58.096515 2020] [:error] [pid 9546] [client 197.2.169.79:13945] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/ma$
[Fri Sep 25 13:50:38.691295 2020] [mpm_prefork:notice] [pid 9535] AH00169: caught SIGTERM, shutting down
[Fri Sep 25 13:50:39.774514 2020] [mpm_prefork:notice] [pid 9646] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Fri Sep 25 13:50:39.774602 2020] [core:notice] [pid 9646] AH00094: Command line: '/usr/sbin/apache2'
[Fri Sep 25 13:51:03.297557 2020] [:error] [pid 9656] [client 197.2.169.79:13957] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/ma$
[Fri Sep 25 13:53:04.053045 2020] [:error] [pid 9662] [client 197.2.169.79:14029] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/ma$
[Fri Sep 25 13:53:15.176827 2020] [:error] [pid 9659] [client 197.2.169.79:14033] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/journey/vendor/laminas/laminas-diactoros/src/functions/ma$
[Fri Sep 25 14:05:25.142831 2020] [mpm_prefork:notice] [pid 9646] AH00171: Graceful restart requested, doing restart
[Fri Sep 25 14:05:25.208834 2020] [mpm_prefork:notice] [pid 9646] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Fri Sep 25 14:05:25.208851 2020] [core:notice] [pid 9646] AH00094: Command line: '/usr/sbin/apache2'

is it a PHP version issue ?

laracoft's avatar

Yes, you need PHP 7.2 and up, the issue is the ?.

Atef95's avatar

@laracoft PHP -V returns

PHP 7.2.33-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug  7 2020 14:43:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.33-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
laracoft's avatar

@atef95 it is a PHP version issue, it's written there in your logs. Upgrade PHP or downgrade your Laravel.

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102
sudo apt install php7.4-common

Please or to participate in this conversation.