Giter Site home page Giter Site logo

help me enable PHP about merecat HOT 25 CLOSED

 avatar commented on May 23, 2024
help me enable PHP

from merecat.

Comments (25)

troglobit avatar troglobit commented on May 23, 2024

Unlike other popular web servers, Merecat does not allow serving content outside its server directory. It's a security thing.
So the data-directory setting in your config must be a sub-directory to /var/www. One way around this is to use bind mounts on Linux, i.e., bind mount /htdocs/php_test to /var/www/php_test

Also, for this to work you need to run the still unreleased (unstable) master branch. It's a work in progress, sorry.

from merecat.

 avatar commented on May 23, 2024

yes, my proyect or test proyect it's a subdirectory, /var/www/htdocs/php_test, the script phpinfo.php or /var/www/htdocs/php_test/phpinfo.php it's open, but Merecat with php-cgi do not execute the script, just show source code of script, sorry 😔, my english it's bad

from merecat.

troglobit avatar troglobit commented on May 23, 2024

Aha, OK I'll look into it. See if I can find some time later today, otherwise it'll be tomorrow. Don't worry about your English, we'll manage :)

In the meantime, have you seen my write-up of how to use regular CGIs? 👉 https://troglobit.com/2019/08/Basic-CGI-in-C-with-Merecat-httpd/

from merecat.

troglobit avatar troglobit commented on May 23, 2024

OK, I've reproduced your problem. Looking into it

from merecat.

troglobit avatar troglobit commented on May 23, 2024

Found it! :-)

Turned out to be a regression introduced fairly recently. Sorry about the problems it caused you! :-(

from merecat.

 avatar commented on May 23, 2024

yes php now works but only if merecat is executed in the current directory, if the "directory" variable is configured, php stops working, if it is not configured php works again

from merecat.

troglobit avatar troglobit commented on May 23, 2024

Sorry about that. The data-directory directive isn't really supposed to be used when you're not also chrooting. I've just pushed another patch for this to master, making sure to compose the resulting path to the server root even when not chrooting.

from merecat.

troglobit avatar troglobit commented on May 23, 2024

@RicardoG08 Does everything work now, or do you have any lingering problems and want me to reopen this issue?

from merecat.

 avatar commented on May 23, 2024

php works fine if chroot = false, I thought this variable should be true if directory is proposed

from merecat.

troglobit avatar troglobit commented on May 23, 2024

Nope, chroot is an actual dedicated confined area, like the man page chroot(1) says. In a chroot you cannot access anything outside of it, like /usr/bin/php-cgi or even the C library in /usr/lib. Thank you for responding, I'll make sure to clarify these things in the documentation!

from merecat.

 avatar commented on May 23, 2024

very well, I really like Merecat, I am using it for my PHP practices, it is easy to configure compared to other http / https web servers, I will keep testing the software, and I will report bugs or any problems I find, it is the only way I can help the project

from merecat.

troglobit avatar troglobit commented on May 23, 2024

Thank you so much! All contributions are welcome :-)

I want to add more simple (!) unit tests. Those are just scripts that usually employ curl. Take a look at how I added a basic CGI test here -> 6a0735f. Wanted to add a php test as well, but I'm not that well versed in php, and I don't have any example PHP CGI in the repo. But I guess a simple phpinfo test would be really useful.

from merecat.

 avatar commented on May 23, 2024

hello again, how long has it been ..., i have continued testing merecat since then, haven't you considered adding support for different extensions for indexes? for example index.php natively?

from merecat.

troglobit avatar troglobit commented on May 23, 2024

Great to hear back from you!

Did you mean like this, which is already in merecat.h?

/* CONFIGURE: A list of index filenames to check.  The files are searched
** for in this order.
*/
#define INDEX_NAMES "index.shtml", "index.shtm", "index.stm",	\
		"index.cgi", "index.php",			\
		"index.html", "index.htm",			\
		"index.xhtml", "index.xht",			\
		"Default.htm"

from merecat.

 avatar commented on May 23, 2024

yes, I have it exactly the same, but it does not detect the index.php unless I tell it explicitly from the browser url

from merecat.

troglobit avatar troglobit commented on May 23, 2024

Well that's a bug (separate from this one, so we should open a new one), unless you have one of the other ones also in the root directory?

from merecat.

 avatar commented on May 23, 2024

my root directory is "/ var / www" with a "data-directory = / htdocs", which contains the folders "/ a", "/ b" and "/ c", the folders "a" and "b" they contain an index.html and it works fine, but folder "c" has an index.php, it doesn't run automatically unless I specify it in the browser url

from merecat.

troglobit avatar troglobit commented on May 23, 2024

OK, that's certainly not how it's supposed to work. It should check for all the INDEX_NAMES in a directory. Could you please open a separate bug report for this?

from merecat.

troglobit avatar troglobit commented on May 23, 2024

Thank you <3

from merecat.

 avatar commented on May 23, 2024

Merecat not support Query strings in PHP??

from merecat.

troglobit avatar troglobit commented on May 23, 2024

I don't even know what that is, but the full environment and arguments to the CGI should be passed to php, if that's what you mean?

from merecat.

 avatar commented on May 23, 2024

yes, exactly, but for example, Mercat returns error 403 for a valid url like the following:

http://192.168.1.1/htdocs/foro/fudforum/install.php?1463445063

from merecat.

troglobit avatar troglobit commented on May 23, 2024

Aha, well that's yet another bug (and more for me to do, unless someone pitches in). Please report a separate issue.

from merecat.

 avatar commented on May 23, 2024

sorry if I'm not helpful in terms of programming
:'c, when I discovered Merecat I really liked the ease of having http / https server ready to use, I am a student and I am focusing or specializing in the administration of GNU / Linux servers and backend programming.

from merecat.

troglobit avatar troglobit commented on May 23, 2024

I understand, that's OK. Free/Open Source Software needs all sorts of talent to help out :)

from merecat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.