dev-labs-bg / sportify

Football match prediction game with simple rules, built on Symfony
GNU Affero General Public License v3.0
33 stars 13 forks source link

can't get the web app running #25

Open carlos2727 opened 6 years ago

carlos2727 commented 6 years ago

Hi, for some reason I can't get this running on my server.

I have a regular apache server with php 7.2.6 (because the symfony requirements states that it needs 7.1.3) I carefully read the installation details and here's what happens..

// Clearing the cache for the prod environment with debug false PHP Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/wc/vendor/symfony/monolog-bundle/DependencyInjection/Configuration.php on line 627 [Doctrine\DBAL\Exception\ConnectionException] An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) [Doctrine\DBAL\Driver\PDOException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) [PDOException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)

I then tried to run the following commands from your doc (Create your admin user, Give yourself Admin access..) and keep getting the same error without the php warning count.

Please help, I would like to have this running asap. Thanks!

aminvakil commented 6 years ago

As I see in your error log you're trying to connect to database via root user which it's not correct and secure. You should create a specific user for sportify in your mysql using this command:

create database sportify;
CREATE USER 'sportify_usr'@'%' IDENTIFIED BY 'something-really-random';
GRANT ALL ON sportify.* TO 'sportify_usr'@'%';
FLUSH PRIVILEGES;
exit

You can also check the full wiki in this link: https://github.com/dev-labs-bg/sportify/wiki/Setting-up-the-project-on-DigitalOcean-droplet-from-A-to-Z

carlos2727 commented 6 years ago

@aminvakil Thanks for the quick reply, I was able to fix this by creating a different user than root and setting the permission to the table, I also had to go to /app/config/parameters.yml to enter the correct values for the db.

Now after entering the commands to create users for the admin section I try to navigate to the folder where I created the project /project/web/ and I'm getting a blank page.. nothing loads it's an empty doc If I try /web/config.php (I left it there to test) it's showing the page where all validation have passed. I'm not sure what I'm missing...

aminvakil commented 6 years ago

Make sure apache has permissions to execute files created by sportify and make sure www-data user is owner of your file and also make sure .htaccess is enabled. Also try http://YOUR_IP/app_dev.php, if it says You are not allowed to access this file. Check app_dev.php for more information. Try http://localhost/app_dev.php As it can show you errors from symphony.

cmihaylov commented 6 years ago

Please make sure that your apache web server config has document root set to: /web

carlos2727 commented 6 years ago

@aminvakil

I installed this on a server with a specific ip. So I don't think I can use localhost/app_dev.php, it has to be with the correct ip.

Here's the folder structure of what's on the server (I have multiple sites under the html folder) var/www/html/site1 var/www/html/site2 ...

@cmihaylov since I have multiple websites running on the same server, I guess I can't really set doc root to project_folder -> /web right?

thanks for the help!

aminvakil commented 6 years ago
<VirtualHost abc.xyz:80>
        ServerName abc.xyz
        ServerAdmin info@xyz.com
        DocumentRoot /var/www/html/web
        <Directory /var/www/html/web/>
               Options FollowSymLinks MultiViews
               AllowOverride All
               Order allow,deny
               allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
cmihaylov commented 6 years ago

If you have multiple sites running on the same server then you probably have virtual hosts set up for each website. Then you need to have one setup for sportify too.

If you have all your sites for example in /var/www/ like this: /var/www/site1 /var/www/site2 /var/www/sportify

Then you need to have the Sportify virtual host section's document root point to: /var/www/sportify/web

carlos2727 commented 6 years ago

@aminvakil thanks, I copied the info and added the correct path to the sportify folder. Still nothing, I get a blank page..

@cmihaylov I created the virtual server for sportify [/wc/web/] but I'm still getting a blank page 423426457567

When trying to go to .../wc/web/ it's showing a blank page and the console is not showing any errors, it's an empty DOM.

I'm still able to go to /web/config.php /web/app_dev.php is returning "You are not allowed to access this file. Check app_dev.php for more information."

aminvakil commented 6 years ago

Check /var/log/apache2/access.log && /var/log/apache2/error.log. Maybe you could find something useful. Also try this command and browse localhost/app_dev.php ssh -D 1080 <your_user>@<your_ip> It will create a socks5 tunnel in your 1080 port and you can browse through your server if you change your browser proxy settings. Socks5: Host: localhost Port: 1080