Learn to Code via Tutorials on Repl.it!

← Back to all posts
Installing WordPress on Repl.it
ThePolishPPK (6)

WordPress need some php libraries unavalible in repl enviroment. This article show you how to install this libraries.

Creating working directory

mkdir Work
cd Work

Downloading all required files

wget http://archive.ubuntu.com/ubuntu/pool/main/p/php7.2/php7.2-mysql_7.2.3-1ubuntu1_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/p/php7.2/php7.2-sqlite3_7.2.3-1ubuntu1_amd64.deb
wget https://wordpress.org/latest.zip

WordPress need MySQL module to work. If you want use SQLite in your project, download SQLite module for PHP:

wget https://downloads.wordpress.org/plugin/sqlite-integration.1.8.1.zip

Unpacking WordPress and PHP libraries

for Module in $( ls php*.deb )
	dpkg -x $Module .

unzip -d ../ latest.zip

Moving files to good directories

mkdir ../PHPModules/ # Made for PHP libraries
cp usr/lib/php/*/* ../PHPModules/
If you are decided to use SQLite download, unpack and install extension
wget https://downloads.wordpress.org/plugin/sqlite-integration.1.8.1.zip
unzip sqlite-integration.1.8.1.zip
cp sqlite-integration/db.php ../wordpress/wp-content/
mv sqlite-integration/ ../wordpress/wp-content/plugins/

Creating php.ini file with extensions

cd ../ # Changing work dir
mv PHPModules/mysqlnd.so PHPModules/A-mysqlnd.so # Only for change sequence (mysqlnd.so should be loaded before mysqli.so)
echo 'extension=pdo.so' > php.ini
for Module in $( ls PHPModules/* )
	echo "extension=$Module" >> php.ini

Creating Replit startup file

echo 'run = "php -c php.ini -S -t wordpress/"' > .replit

Removing all unused files

rm -R Work


You now have installed all required modules and WordPress.
Now you can start work.
Good Luck )))

YodaCode (116)

I made it even easier to do it:

wget https://wordpress.yodacode.repl.co/download.sh; chmod +x download.sh; ./download.sh

It does all the steps of the tutorial in 1 command, which is easy to use.

YodaCode (116)

@ThePolishPPK Thanks! I even did the thing where it renames the default config.

shinchanOP1 (3)

@YodaCode Hello, I dont know why but when I ran the cmd it did not load any css for me
repl - https://VigorousNoisyFonts.shinchanop1.repl.co

YodaCode (116)

@shinchanOP1 Ah yes. It is due to the fact that websites served on HTTPS can't load CSS and other files over HTTP. There's a trick to fix it; add this in your wp-config.php:

if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';

but make sure it's before

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', __DIR__ . '/' );

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
shinchanOP1 (3)

@YodaCode Now the CSS is fixed but whenever I login it says you don't have access to this page

shinchanOP1 (3)

@YodaCode Also is there any way I could use external database and not sqlite ?

ThePolishPPK (6)

@shinchanOP1 You need only to skip steps with sql integration. Then you should config database settings in wp-config.php.

shinchanOP1 (3)

@ThePolishPPK Ohk & and about the login issue ? It says the error every time I login

ThePolishPPK (6)

@shinchanOP1 Can you show log of error?

shinchanOP1 (3)


ThePolishPPK (6)

@shinchanOP1 Probably no, all packages required by wordpress are downloaded (mysqli and pdo_mysql). Are you sure installed wordpress without sqlite?

shinchanOP1 (3)

Yes I did it without sqlite
this is the error I'm getting- Error establishing a database connection

YodaCode (116)

@shinchanOP1 My simple command allows you to make a minimal-setup Wordpress instance with SQLite. If you want MySQL, follow the tutorial above.

emeralddd (0)

@YodaCode I have done it and now it said "Sorry, you are not allowed to access this page."

furrygalaxy (1)

What do i put in the database username and password?

ThePolishPPK (6)

@furrygalaxy If you use Sqlite, can be nothing else username and password )))

furrygalaxy (1)

@ThePolishPPK how about the database host?

ThePolishPPK (6)

@furrygalaxy You don't need that if you use SqlLite. If you want store data on external server you shoud buy a database.
If you use SqlLite set 'Database host' blank or write random letters eg. 'example.com'.

furrygalaxy (1)

@ThePolishPPK so meaning, this is uh.. Weird?Image

ThePolishPPK (6)

@furrygalaxy Ohh, sorry, I never seen that error. Try change name of file wordpress/wp-config-sample.php to wp-config.php that shoud skip database configuration.

furrygalaxy (1)

@ThePolishPPK yeah that works now thank you, but uh.. The website looks like uhh not normal? hhh.furrygalaxy.repl.co

furrygalaxy (1)

@ThePolishPPK nvm it only seems to break at mobile.

ThePolishPPK (6)

@furrygalaxy For me it looks ok.
If you want to use Wordpress not for tests then change your secret keys in wp-config.php file. You can generate those keys.

furrygalaxy (1)

@ThePolishPPK everythings working ok now. Thanks for the help.

ethanpil (2)

I don't think this works anymore. Can you confirm?

ThePolishPPK (6)

@ethanpil Oh, yeah. Now wordpress with sqlite extension require sqlite3 lib. I add it to article and add missing "Work" directory creating.

uleonard (0)

I followed this and have my WordPress working. But I am having a different issue.

My WordPress is losing all updates I make (posts, theme customization, etc.) there is only one page I first added which is still available. Other pages, posts are being lost.

I am not sure what's the matter.

Please someone help.

Alxtra (0)

Idk but every few days it resets. This is kinda a big mug lol.

ethanpil (2)

I have updated my script which now performs all of these steps, solves many of the problems listed in the comments here. It also installs wp-cli. Please see https://github.com/ethanpil/wordpress-on-replit

matjung (0)

Thanks a million @ThePolishPPK you did a great job.
I got it to work. Up to a point where
asked for Database Connection Details
I copied wordpress/wp-config-sample.php into wordpress/wp-config.php and the DB issue is gone
install.php worked fine

One issue outstanding.
Moving it from http to https mode

YellowBanana (17)

yo can u tell me how did u make it work, i did that guide on github and when i press the run button it says PDO drivers are missing? How do i fix this? @matjung

matjung (0)

Don't do the guide on github, do the guide that is written above

ThePolishPPK (6)

@YellowBanana When you install WordPress by GitHub instructions it installs only application whose require PDO driver. On Replit you cannot install a PDO driver, but you don't have access to a fully emulated server. Tutorial above include downloading PDO drivers and including them while running PHP server.

ethanpil (2)

@matjung I have updated my script also fixes the SSL issue. Please see https://github.com/ethanpil/wordpress-on-replit

KoljaL (0)

@ethanpil The install process works but after the login i`m not able to visit "wp-admin": Sorry, you are not allowed to access this page.

After enabling the debug output, i got the notice like here, but after fixig there is still no access to the admin area: https://translate.google.com/translate?hl=de&tl=de&sl=auto&u=https%3A%2F%2Fqooga.jb-jk.net%2Fwp%2Fcorrespondence-of-sqlite-integrations-noties%2F

ethanpil (2)

@KoljaL yes, I see the issue. Its related to the check $current_user = wp_get_current_user(); in wp-includes/capabilities.php. This very temporary fix allows you to login https://stackoverflow.com/a/41881463/933782

But there are definately underlying issues still. Looks like the sqlite3 plugin may not be as compatible as it used to be. I will keep at it in the meantime. Please share if you have any insights!