YOURLS just doesn't install, debugging shows nothing.

Created on 12 Sep 2018  Â·  11Comments  Â·  Source: YOURLS/YOURLS

Technical details regarding my environment

  • YOURLS version: LATEST

    • Plugins enabled: NONE

  • PHP version: 7.0.31-1-ubuntu-18.04

Bug description

Not exactly a bug, but nginx does not view my index.php under admin page as an "index page", and when I force it to go to that page (sub.domain.com/admin/index.php) it downloads it as a file.

What is the expected or desired behavior?

It should auto open index.php as an index file when navigating to http://sub.domain.com/admin/

Reproducible bug summary

https://wemake.blackniggers.work/admin

I have made sure I have the correct chmod on the file (755) and the public_html folder is also under chmod 755. Also I had to remove these lines in order to not get a 502 error (using cloudflare).

duplicate question

Most helpful comment

"we make black niggers work". Wow.

All 11 comments

The lines you removed are actually what make PHP and YOURLS work. You probably got 502 (a Bad Gateway error) because of the line fastcgi_pass unix:/var/run/php/php7.0-fpm-your_user.sock;, which will require changing to the actual path to the Unix socket PHP-FPM uses on your server.

Our wiki page on using nginx has a simple config with clear comments, and maybe you can build off of that to get your site up. I can't really tell you exactly what to put in there, because I don't have all the details of your environment. (However, I don't believe PHP puts any username in the socket filename by default. It's probably set to /var/run/php/php7.0-fpm.sock unless you customized it.)

Definitely a not-found socket behavior.
Please review your configuration with your host! 🙂

The lines you removed are actually what make PHP and YOURLS work. You probably got 502 (a Bad Gateway error) because of the line fastcgi_pass unix:/var/run/php/php7.0-fpm-your_user.sock;, which will require changing to the actual path to the Unix socket PHP-FPM uses on your server.

Our wiki page on using nginx has a simple config with clear comments, and maybe you can build off of that to get your site up. I can't really tell you exactly what to put in there, because I don't have all the details of your environment. (However, I don't believe PHP puts any username in the socket filename by default. It's probably set to /var/run/php/php7.0-fpm.sock unless you customized it.)

It turns out the php fpm.sock file was under /run/php/php7.2-fpm.sock; find / -iname php7.0-fpm.sock turned up nothing so I uninstalled php7.0, and reinstalled php7.2, which then turned up this file. After a bit of messing around, I was able to access it by typing in admin/index.php, but now I have a completely different issue. After installing php7.2-mysql in order for the Install YOURLS button to actually show up, after a PDOException error, I can't actually shorten URLS it seems. After clicking Install YOURLS, it brought me to the same page but with a ? at the end of the url, and the whole page was white. After turning on debug mode and restarting nginx, it... still gave me a blank screen? I just assumed it worked, so after shortening test.com with ShareX, YOURLS literally gave me the html script of user/install.php I have literally no idea what's going wrong as I don't know where I went wrong or the error that is happening. The debug script given at install.php is Connected to database yourls on localhost SQL: SHOW TABLES LIKE 'yourls_options' (0.00010 s)

The fact that you have to directly enter index.php means you're missing an index directive in the nginx configuration. index index.php; in your server block for YOURLS should fix that.

I don't know where you're looking for errors, but you said you turned on "debug mode" and restarted nginx. What debug mode? If you mean PHP's, you need to restart the php-fpm (or php7.2-fpm) service. Restarting nginx will not reload PHP's configuration. Though errors from PHP should appear in nginx's error log, unless that has changed in newer versions.

Visiting your link myself and clicking the "Install YOURLS" button gave me the described blank page with a 500 Internal Server Error code, indeed. But there's no further troubleshooting I (or any other YOURLS team member) can do without log information.

The debug mode I was referring to was YOURLS’ built in one. Also, other than nginx log information, where would I find YOURLS specific log information?

EDIT: Reread your comment and reverted some of my comment.

YOURLS debug mode prints it below the footer:

https://github.com/YOURLS/YOURLS/blob/6228a2874e532002286e99ecb364efb4eaa573fb/includes/functions-html.php#L161-L165

If the error is severe enough to cause a 500, though, nothing gets printed (because outputting the page is aborted) and the YOURLS_DEBUG setting won't help you.

The internal server error details should be in one of two places: The nginx error log (if configured), or PHP's error log (if configured). If neither logging location is configured, and PHP is set not to output errors (as I think was made the default some time ago), you'll have to enable error logging and/or reporting in nginx's and/or PHP's configuration and restart the daemon(s), then trigger the error again.

"we make black niggers work". Wow.

"we make black niggers work". Wow.

@ozh <3
Anyway, nginx log is configured, not sure about php though. Where would I find the php error log, and how do I turn on output errors?

Found the error after a bit of tinkering with php.ini files. This shows up after clicking Install YOURLS.
Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes in /var/www/wemake/public_html/includes/vendor/aura/sql/src/ExtendedPdo.php:748 Stack trace: #0 /var/www/wemake/public_html/includes/vendor/aura/sql/src/ExtendedPdo.php(748): PDOStatement->execute() #1 /var/www/wemake/public_html/includes/functions-install.php(252): Aura\Sql\ExtendedPdo->perform('CREATE TABLE IF...') #2 /var/www/wemake/public_html/admin/install.php(46): yourls_create_sql_tables() #3 {main} thrown in /var/www/wemake/public_html/includes/vendor/aura/sql/src/ExtendedPdo.php on line 748

That's a common issue. See other threads (especially https://github.com/YOURLS/YOURLS/issues/2115#issuecomment-294581590) for known resolutions.

oh it works oh my god THANK YOU

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ozh picture ozh  Â·  3Comments

LaughterOnWater picture LaughterOnWater  Â·  5Comments

ChrisChiera picture ChrisChiera  Â·  5Comments

LeoColomb picture LeoColomb  Â·  3Comments

schapsl picture schapsl  Â·  4Comments