[SOLVED] Wordpress, MySQL, Lighttpd on DDWRT (R7800)

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Goto page Previous  1, 2
Author Message
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Fri Aug 26, 2022 9:09    Post subject: Reply with quote
Follow that how to I linked.

The rest is about paths and config files.

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
Sponsor
StillBlue
DD-WRT User


Joined: 11 Apr 2009
Posts: 257
Location: UK

PostPosted: Fri Aug 26, 2022 9:25    Post subject: Reply with quote
I have followed those, and at the moment I have got a little further, but still not there.

What I have done so far is:

Installed MariaDB from Entware.
Installed php8-fpm and php8-pdo-mysql from Entware
Installed Fastcgi from Entware.
Edited lighttpd.config to point to fastcgi in Entware

Code:
compress.cache-dir = "/tmp/lighttpd/cache/compress/"
compress.filetype   = ("text/plain", "text/html")
fastcgi.debug       = 0
fastcgi.server = (
".php" =>
( "localhost" =>
   ( "socket" => "/tmp/php-fcgi.sock-0",
   "bin-path" => "/opt/bin/php-cgi",
   "max-procs" => 1,
   "bin-environment" =>
      (
      "PHP_FCGI_CHILDREN" => "2",
       "PHP_FCGI_MAX_REQUESTS" => "500"
      )
   )
)
)


This now gives me the error 'No input file specified.' when I point my browser at any PHP script on lightpd, so I am obviously closer now than I was, but still need to iron out that error.

When I ask 'php-fpm -m' it now shows all modules, so I was querying the wrong PHP (The DD-WRT one).
StillBlue
DD-WRT User


Joined: 11 Apr 2009
Posts: 257
Location: UK

PostPosted: Fri Aug 26, 2022 9:45    Post subject: Reply with quote
It's running. It appears all that was left to do was comment out the line the doc_root = entry in php.ini.

I will document the process properly later, once I have tested it's working properly.



Wordpress Running 2.png
 Description:
 Filesize:  120.35 KB
 Viewed:  2135 Time(s)

Wordpress Running 2.png



Wordpress Running.png
 Description:
 Filesize:  85.65 KB
 Viewed:  2146 Time(s)

Wordpress Running.png


StillBlue
DD-WRT User


Joined: 11 Apr 2009
Posts: 257
Location: UK

PostPosted: Sat Aug 27, 2022 9:48    Post subject: Reply with quote
OK, I have wiped down and started afresh to check the procedure works, and this is what I did to get Wordpress up and running.

Firstly I already had lighttpd up and running.

Then with a freshly formatted USB stick one partition in ext4 called optware and one 2gb partition as a swap partition (MariaDB wouldn't run for me without swap) I then followed the instructions for installing Entware.

https://wiki.dd-wrt.com/wiki/index.php/Installing_Entware

I then installed MariaDB and necessary PHP8 packages.

Code:
opkg install mariadb-server mariadb-server-extra mariadb-client mariadb-client-extra php8-mod-pdo-mysql php8-mod-mysqli php8-fastcgi php8-fpm php8-mod-filter php8-mod-session php8-mod-curl php8-mod-xml php8-mod-gd php8-mod-intl php8-mod-zip php8-mod-dom php8-mod-exif php8-mod-fileinfo php8-pecl-imagick


Then ran the initial MySQL setup which does set off some warnings about InnoDB being disabled, and failing to set memory, but it ran regardless.

Code:
mysql_install_db --force


Then edit /opt/etc/mysql/conf.d/50-server.cnf with the following lines under the [mysqld] section to fix the output errors from above.

Code:
# skip InnoDB initialization
skip-innodb
# set default storage engine to MyISAM instead
default-storage-engine = myisam


Then after a reboot I was able to set a password for MySQL (you can read up about changing usernames and passwords, but I mearly set a password for the root user)

Code:
/opt/bin/mysqladmin password desired_mysql_password


Then I logged in using, which then prompts you for the password you have set.

Code:
mysql -u root -p


Now I created the database I will use with Wordpress

Code:
mysql> create database my_first_database;
mysql> grant all privileges on my_first_database.* to root@localhost identified by 'desired_mysql_password';
mysql> quit


Then I have gone into lightpd.conf and added the path to fastcgi and its socket

Code:
fastcgi.debug       = 0
fastcgi.server = (
".php" =>
( "localhost" =>
   ( "socket" => "/tmp/php-fcgi.sock",
   "bin-path" => "/opt/bin/php-cgi",
   "max-procs" => 1,
   "bin-environment" =>
      (
      "PHP_FCGI_CHILDREN" => "2",
       "PHP_FCGI_MAX_REQUESTS" => "500"
      )
   )
)
)


Then last but not least in /opt/ect/php.ini I have commented out the line

Code:
#doc_root = "/opt/share/www"


A reboot then was all that was needed, and Wordpress was able to be started and configured to use the database that I have set up.

Hope this helps anyone else who has the same struggle.



Wordpress Server.png
 Description:
 Filesize:  19.16 KB
 Viewed:  746 Time(s)

Wordpress Server.png




Last edited by StillBlue on Thu May 11, 2023 18:01; edited 14 times in total
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Sat Aug 27, 2022 9:53    Post subject: Reply with quote
Congrats, nice work.

I altered the title of this thread slightly so that it can be easier found as this is very useful Smile

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
IONK
DD-WRT Guru


Joined: 19 Aug 2011
Posts: 963

PostPosted: Mon Aug 29, 2022 19:38    Post subject: Reply with quote
StillBlue wrote:
OK, I have wiped down and started afresh to check the procedure works, and this is what I did to get Wordpress up and running.
Thanks for sharing. I followed you steps and I was able to get MariaDB working.
Catches that saved my a**:
  • MariaDB wouldn't run for me without swap : mysql_install_db --force returned "Segmentation fault" because I didn't have Linux Swap partition. I resized & created the 2GB swap partition (took 3hrs), after that no more seg fault. Before seeing your post, I also remember seeing someone mentioning about swap file while Google-ing, but I'm lazy to dig up the details to see what's the minimum space to allocate to swap partition.
  • skip InnoDB initialization & set default storage engine to MyISAM instead : this definitely saved me a lot of time. Is is because of ddwrt or because of Entware?

Once getting past these, it's not difficult to create new user, grant permissions, enable remote access, restore data from dump file, install phpMyAdmin... I include the info I found here in case someone needs it:
https://mariadb.com/kb/en/restoring-data-from-dump-files/
https://stackoverflow.com/questions/59577312/mariadb-cannot-connect-to-mariadb-instance-from-dbeaver-using-correct-password
https://webdock.io/en/docs/how-guides/database-guides/how-enable-remote-access-your-mariadbmysql-database
https://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server
https://hqt.ro/how-to-install-mariadb-server-phpmyadmin-on-entware/
https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql

IONK wrote:
Router/Version: Netgear XR500 (Install guide by egc)
File/Kernel: dd-wrt-webupgrade.bin (r49976) / Linux 4.9.326 #1181 SMP Mon Aug 29 01:53:59 +07 2022 armv7l
Previous/Reset: DD-WRT v3.0-r49934 std (08/28/22) / no
Mode/Status: AP, SFE, AP 5GHz Mixed 80MHz + AP 2.4GHz NG-Mixed 40MHz, 802.11r (FT), DDNS (Dynu), 802.11 encapsulation offloading, ondemand CPU governor at night, USB Storage (guide by egc), lighttpd (using Entware’s php8), CIFS Automount, WireGuard server, Cron / working
Issues/Errors: Switch config page doesn't look normal, see the screenshot of Jovan. With r49934 was OK

_________________
▫ RSS feed for DD-WRT releases (2024): https://rsseverything.com/feed/7d36ab68-7733-46c3-bd8a-9c54c5cef08c.xml
easyddup - A simple upgrade/downgrade utility by yoyoma2 --- as featured in 📌 Reference Links, stickies retired back to forum (Moderator's Pick 🌟)
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Mon Aug 29, 2022 21:55    Post subject: Reply with quote
@IONK thanks for making it easy to read your links.


Capture.PNG
 Description:
 Filesize:  11.03 KB
 Viewed:  2026 Time(s)

Capture.PNG



_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
StillBlue
DD-WRT User


Joined: 11 Apr 2009
Posts: 257
Location: UK

PostPosted: Sun Sep 04, 2022 9:37    Post subject: Reply with quote
For my own notes, I am finding PHP8 a tiny bit buggy with a few plugins, so I may have a look at downgrading back to PHP 7.4.30, which is what most commercial webservers still appear to be using.

http://bin.entware.net/armv7sf-k3.2/archive/


Last edited by StillBlue on Sun Sep 04, 2022 10:23; edited 1 time in total
IONK
DD-WRT Guru


Joined: 19 Aug 2011
Posts: 963

PostPosted: Sun Sep 04, 2022 10:03    Post subject: Reply with quote
StillBlue wrote:
For my own notes, I am finding PHP8 a tiny bit buggy with a few plugins, so I may have a look at downgrading back to PHP 7.4.30, which is what most commercial webservers still appear to be using.

https://bin.entware.net/armv5sf-k3.2/archive/
Indeed! My production server is still running PHP7, and my existing PHP files are not compatible with PHP8, so there are a lot of errors when I just anyhow make the switch from the production server to ddwrt server.
I've looked for the way to downgrade to PHP7, I still don't know how to do that yet. At the moment, my colleague helps me to temporarily fix the compatibility issue on the go, just for testing the new project codes, but it will be good to have a way to run Entware's PHP7 on ddwrt.

_________________
▫ RSS feed for DD-WRT releases (2024): https://rsseverything.com/feed/7d36ab68-7733-46c3-bd8a-9c54c5cef08c.xml
easyddup - A simple upgrade/downgrade utility by yoyoma2 --- as featured in 📌 Reference Links, stickies retired back to forum (Moderator's Pick 🌟)
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Tue Sep 06, 2022 10:25    Post subject: Reply with quote
IONK wrote:

I've looked for the way to downgrade to PHP7, I still don't know how to do that yet. At the moment, my colleague helps me to temporarily fix the compatibility issue on the go, just for testing the new project codes, but it will be good to have a way to run Entware's PHP7 on ddwrt.

Well you can compile PHP 7 from source codes, but it's possibly not what you want.

This thread looked interesting:

opkg --force-downgrade? - NI Community
https://forums.ni.com/t5/NI-Linux-Real-Time-Discussions/opkg-force-downgrade/td-p/3562374

I'm unable to find a way to add nor change Entware repository, and I doubt whether there are repositories carrying old packages.

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
StillBlue
DD-WRT User


Joined: 11 Apr 2009
Posts: 257
Location: UK

PostPosted: Tue Sep 13, 2022 6:43    Post subject: Reply with quote
All old packages are here: (This is for my r7800)

https://bin.entware.net/armv5sf-k3.2/archive/

You can install from URL.
Goto page Previous  1, 2 Display posts from previous:    Page 2 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum