Replit wont load php files

So I’ve been trying to install mediawiki (i have already downloaded and extracted the files via the shell). I’ve tried to make an index.php file run on the website, but it won’t load.

Here’s the repl:
https://replit.com/@icantthinkofausername/mediawikitest

Try using the PHP template instead of the HTML/CSS/JS template.

3 Likes

ill try to and give any updates :ok_hand:

ok i redownloaded it on the new repl, its extracting rn


yeah i can access the install page

So it works? Did that solve the problem?

Me and @youngchief could help you optimize your mediawiki install, we’ve set it up before

2 Likes

uh

i have a problem

You need to run a database server (or use sqlite).

1 Like

how do i do install that?

It’s already installed, @youngchief will probably give a better answer. Also, maybe use nginx instead of the PHP dev server (for performance).

is the host REPLIT_DB_URL?

No, replit db isn’t an actual database that programs can use. You’d probably need an sqlite database.

1 Like

We recommend Postgres as your database for its performance. However, it is tricky to explain its setup on Replit in particular. Especially since I haven’t blogged about it (I probably should!). Yes, I agree you should set up nginx. However, for nginx you’ll want to compile from source which is a bit tricky to get right, especially since the version in nixpkgs is outdated by quite a few versions.

You’ll want to have nginx.conf like the following:

daemon off;
events {
  worker_connections  2048;
}
http {
  include mime.types;
  default_type application/octet-stream;
  sendfile on;
  keepalive_timeout 0;
  gzip on;
  tcp_nopush on;
  tcp_nodelay on;
  server {
    listen 80;
    server_name  localhost;
    location / {
      proxy_pass 'http://127.0.0.1:8080/';
    }
  }
}

Feel free to ask for additional support.

You need php-fpm for PHP (and it’d probably be fastcgi_pass)

1 Like

do i put this in the mw-config folder?

i mean the .conf file

No… You need to set up nginx first. If you add us to your repl, we’ll probably help

1 Like

here’s the repl:

https://replit.com/@icantthinkofausername/mediawikitestII#mediawiki-1.39.2.tar.gz

https://mediawikitestii.icantthinkofausername.repl.co/mediawiki-1.39.2/mw-config/index.php

(Probably because we might install solanum in your repl in the process of helping)(/j)

1 Like

We can’t edit that, could you invite 9pfs and youngchief to your repl?

1 Like

As for compiling nginx from source, change your replit.nix to the following dependency list:

{ pkgs }: {
	deps = [
        pkgs.perl
		pkgs.pcre.dev
		pkgs.openssl.dev
		pkgs.libressl.dev
		pkgs.libressl
		pkgs.zlib.dev
		pkgs.zlib
		pkgs.openssl
		pkgs.openssl.dev
		pkgs.pkg-config
		pkgs.libxslt
		pkgs.libxslt.dev
		pkgs.gd.dev
		pkgs.geoip
		pkgs.wget
	];
}

Then run this (after changing replit.nix):

wget https://nginx.org/download/nginx-1.23.3.tar.gz
cd nginx-1.23.3
./configure --prefix=/home/runner/$REPL_SLUG/nginx --with-select_module --with-poll_module --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module 
make
make install
cd ..