codenathan / storage

Backend PHP API with Custom Storage options ( MySQL / FileSystem) & FrontEnd One Page CRUD Application using VueJS2 / Vue Router / Vue Resource Front End
0 stars 0 forks source link

settings suggestion? #1

Closed persianphilosopher closed 7 years ago

persianphilosopher commented 7 years ago

I feel reluctant to open an "issue" as this must be a mistake on my end and I hope it's not a waste of your time. I have been - very slowly - working on making my own webapp that serves markdown via the filesystem and mostly for learning purposes. Most repos understandably focus on CRUD with database, however, and I was thrilled to run across yours because it is gorgeous and straightforward. I had hoped to be able to play with it and learn a few more tricks but I cannot for the life of me make it work at all.

I cloned the repo, ran composer. The index page shows up as expected but I cannot add a user and I have nothing in my error logs to tell me where I am going wrong. I suspect it's because I am not trying to use it with a database. Is there a setting I am missing to make "storage" work with filesystem?

Any hint would be greatly appreciated and thank you for sharing your code here!

codenathan commented 7 years ago

@persianphilosopher the default settings should work with the filesystem. My first guess may be file permissions to the storage/data/user folder may not be allowing it. Without knowing your environment I cannot tell. Could you please let me know the following : - Your operating system , PHP version , Apache/Ngnix Version you are running. Have you also setup your vhost properly when you are viewing this application? the directory should be set to the public folder. I.e you should be looking at this as http://storage.app not as http://localhost/public/index.php

persianphilosopher commented 7 years ago

Thank you so much for your reply. I should have provided such basic info right away, I am sorry.

I will try to temporarily switch to Nginx/Apache to see if it makes a difference but the Caddy set up has worked flawlessly with php for a dozen of projects on the same server (Laravel, Symfony, Wordpress, etc.) The console on chrome/ff throws no error and is verbatim the same as your site (the little vuejs warning about production vs dev).

I will also try on localhost on my windows machine and report back. I am sorry I can't find a more meaningful report so far.

codenathan commented 7 years ago

ok all those settings are fine. Could you confirm the PHP version you are running? Just to let you know this application will only run on PHP 7.x. This is due to the encryption method used to generate the token and the use of Twig 2.0 which i believe also runs on that

persianphilosopher commented 7 years ago

It's PHP 7.0

codenathan commented 7 years ago

@persianphilosopher having read around and realised the caddy config file may need a bit of tweaking . I think this may be related to the app using Apache's mod_rewrite. Having read this https://github.com/mholt/caddy/issues/472 and if the .htaccess file current says :

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?qs=$1 [NC,L,QSA]

Which for caddy i believe translates to

rewrite {
    to {uri} {uri}/ /index.php?qs={path_escaped}&{query}
}

Let me know if the above works i could not think of anything else causing this

persianphilosopher commented 7 years ago

That's extremely kind of you to have looked into that...and I feel all the more awful to report that it did not solve the issue.

At this point, I don't think this warrants any further waste of your time for my sake. But, only if it would matter for your own purposes to figure this out, I am happy to give you login access to my server. Right now it's quite bare; it's mostly your webapp, plus php, caddy etc. I even installed apache and enabled rewrite and I still kept hitting the same wall. But, I must insist that it's not for my sake but I am happy for your own sake if you want to take a look at the actual server.

Feel free to email me farhang.erfani[ ]gmail.com if you want the login access and I'll close this otherwise.

codenathan commented 7 years ago

@persianphilosopher I have emailed you :)

codenathan commented 7 years ago

Apache's default configuration was not allowing the .htaccess to be read hence I had to update apache's virtual host file with the below. More on this : - https://www.digitalocean.com/community/tutorials/how-to-use-the-htaccess-file

<Directory /home/storage/public>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
 </Directory>

I will update documentaiton accordingly