Lxw2015
Posts: 84
Joined: Fri Feb 12, 2016 4:05 am

wordpress on pi4 ( solved )

Wed Oct 09, 2019 11:02 pm

I ran 2019-07-10-raspbian-buster-full.zip on pi4.
follow https://www.makeuseof.com/tag/host-word ... pberry-pi/ set wordpress.

I could browse localhost on pi. it show wordpress's sample page.
but on another PC in same LAN, browse pi_ip_address. it display text only.
anybody give a hint, why this happens?

thank you for reading.
Xian
Last edited by Lxw2015 on Fri Oct 11, 2019 11:08 pm, edited 1 time in total.

Andyroo

Re: wordpress on pi

Thu Oct 10, 2019 12:14 am

It does not have the rewrite module running let alone cover the config of the site in Apache.

I’ll not mention the security risk of giving root access to everything via Wordpress or the not needed steps and wrong password use :shock:

Though I am month behind this may help https://www.raspberrypi.org/forums/view ... 1&t=249882

fbe
Posts: 647
Joined: Thu Aug 17, 2017 9:08 pm

Re: wordpress on pi

Thu Oct 10, 2019 3:58 pm

Review the page source in your browser. If you see "http://localhost", try this: https://wordpress.org/support/article/c ... -site-url/
"http://localhost" is working only if you access Wordpress from a browser on your Raspberry Pi.

geektechstuff.com
Posts: 42
Joined: Sat Mar 02, 2019 8:08 pm
Contact: Website

Re: wordpress on pi

Thu Oct 10, 2019 9:46 pm

I don't know if it helps but -

I covered installing Wordpress on Pi using a BASH script here:
https://geektechstuff.com/2019/01/09/in ... bperry-pi/

And here is an awesome Raspberry Pi guide to setting up Wordpress:
https://projects.raspberrypi.org/en/pro ... ordpress/7

When you say it only displays text, I assume you mean it is not displaying any images - this may be a permissions issue depending on where on the Pi you are storing the images.
www.geektechstuff.com

Andyroo

Re: wordpress on pi

Thu Oct 10, 2019 10:07 pm

The Pi one is out of date (I’m trying to get time to master Github to do a pull).

It’s possible that the CSS is not loading (the description is a bit vague on the resulting screen).

WP has a horrid habit of embedding the URL of the site into image locations in the database so it may work fine till you change the site name (localhost to IP address to domain name) - there are a few add-ins that are designed to fix this as part of a site move and I’ve seen at least one set of SQL instructions embedded in PHP to fix this.

fbe
Posts: 647
Joined: Thu Aug 17, 2017 9:08 pm

Re: wordpress on pi

Thu Oct 10, 2019 11:20 pm

geektechstuff.com wrote:
Thu Oct 10, 2019 9:46 pm
...
And here is an awesome Raspberry Pi guide to setting up Wordpress:
https://projects.raspberrypi.org/en/pro ... ordpress/7
...
This guide is so similar to the guide used by the original poster, that you can't tell which is the chicken and which is the egg. It shows that it is possible to install Wordpress but not how it should be installed. It's surely not awesome.

Lxw2015
Posts: 84
Joined: Fri Feb 12, 2016 4:05 am

Re: wordpress on pi

Fri Oct 11, 2019 4:58 pm

geektechstuff.com wrote:
Thu Oct 10, 2019 9:46 pm
I don't know if it helps but -

I covered installing Wordpress on Pi using a BASH script here:
https://geektechstuff.com/2019/01/09/in ... bperry-pi/

And here is an awesome Raspberry Pi guide to setting up Wordpress:
https://projects.raspberrypi.org/en/pro ... ordpress/7

When you say it only displays text, I assume you mean it is not displaying any images - this may be a permissions issue depending on where on the Pi you are storing the images.
yes, no image. seems CSS not working. I don't know where the image is stored. that is all managed by wordpress.
Capture.PNG
Capture.PNG (30.26 KiB) Viewed 1032 times

Lxw2015
Posts: 84
Joined: Fri Feb 12, 2016 4:05 am

Re: wordpress on pi

Fri Oct 11, 2019 5:01 pm

Andyroo wrote:
Thu Oct 10, 2019 10:07 pm
The Pi one is out of date (I’m trying to get time to master Github to do a pull).

It’s possible that the CSS is not loading (the description is a bit vague on the resulting screen).

WP has a horrid habit of embedding the URL of the site into image locations in the database so it may work fine till you change the site name (localhost to IP address to domain name) - there are a few add-ins that are designed to fix this as part of a site move and I’ve seen at least one set of SQL instructions embedded in PHP to fix this.
thank you.
please see my screen clip in upper post.

Andyroo

Re: wordpress on pi

Fri Oct 11, 2019 5:04 pm

Have you installed the rewrite module in Apache?

Did you set anything for permalinks in Wordpress?

fbe
Posts: 647
Joined: Thu Aug 17, 2017 9:08 pm

Re: wordpress on pi

Fri Oct 11, 2019 6:14 pm

Did you ever try to figure out, where your browser is asking for the CSS, that don't work?
E.g. https://wordpress.org/support/article/c ... -site-url/ shows a Wordpress help page, that explains, how you can change “WordPress Address (URL)” and “Site Address (URL)” settings of your installation. The page source contains a lot of links to stylesheets

Code: Select all

...
<link rel='stylesheet' id='dashicons-css'  href='https://wordpress.org/support/wp-includes/css/dashicons.min.css?ver=5.3-beta3-46457' type='text/css' media='all' />
<link rel='stylesheet' id='admin-bar-css'  href='https://wordpress.org/support/wp-includes/css/admin-bar.min.css?ver=5.3-beta3-46457' type='text/css' media='all' />
...
If your page contains links beginning with http://localhost, these styles are available only if your browser is running on your Raspberry Pi. Please follow this help page to configure the IP address (e.g http://10.74.32.140) or a domain name (http://raspberrypi.local) instead as “WordPress Address (URL)” and “Site Address (URL)”.

If this doesn't help, start over and do the initial Wordpress configuration in a browser on your remote PC.

Andyroo

Re: wordpress on pi

Fri Oct 11, 2019 8:25 pm

.htaccess and the rewrite module takes care off redirects from the local machine to a given URL (IP address).

In true WP tradition though, some of the locations are hard coded in the database and not in a separate field but actually embedded in text strings :twisted:

If you do not want to use a plugin then https://snapcreek.com/blog/wordpress/te ... ress-site/ have a good walkthrough from fixing the site address. The tool they link to is https://github.com/interconnectit/Search-Replace-DB and I’ve not used it for around 12-18 months but it’s been really handy moving live sites to test boxes when the original site is only on the live server :lol: :roll: :lol:

Lxw2015
Posts: 84
Joined: Fri Feb 12, 2016 4:05 am

Re: wordpress on pi

Fri Oct 11, 2019 8:42 pm

Andyroo wrote:
Fri Oct 11, 2019 5:04 pm
Have you installed the rewrite module in Apache?

Did you set anything for permalinks in Wordpress?
I ran
sudo a2enmod rewrite
sudo systemctl restart apache2
to enable rewrite url, refresh browser. same result.
I did not change permalinks in Wordpress. it sets as Custom Structure /index.php/%year%/%monthnum%/%day%/%postname%/

Andyroo

Re: wordpress on pi

Fri Oct 11, 2019 8:49 pm

Make sure you save the permalinks.
What do you have defined in general settings for the two URLs

Also, are you aware of the ‘first steps’ document https://wordpress.org/support/article/f ... s-classic/ (the old codex)?

Lxw2015
Posts: 84
Joined: Fri Feb 12, 2016 4:05 am

Re: wordpress on pi

Fri Oct 11, 2019 9:09 pm

fbe wrote:
Fri Oct 11, 2019 6:14 pm
Did you ever try to figure out, where your browser is asking for the CSS, that don't work?
E.g. https://wordpress.org/support/article/c ... -site-url/ shows a Wordpress help page, that explains, how you can change “WordPress Address (URL)” and “Site Address (URL)” settings of your installation. The page source contains a lot of links to stylesheets

Code: Select all

...
<link rel='stylesheet' id='dashicons-css'  href='https://wordpress.org/support/wp-includes/css/dashicons.min.css?ver=5.3-beta3-46457' type='text/css' media='all' />
<link rel='stylesheet' id='admin-bar-css'  href='https://wordpress.org/support/wp-includes/css/admin-bar.min.css?ver=5.3-beta3-46457' type='text/css' media='all' />
...
If your page contains links beginning with http://localhost, these styles are available only if your browser is running on your Raspberry Pi. Please follow this help page to configure the IP address (e.g http://10.74.32.140) or a domain name (http://raspberrypi.local) instead as “WordPress Address (URL)” and “Site Address (URL)”.

If this doesn't help, start over and do the initial Wordpress configuration in a browser on your remote PC.
on my pi. everything works fine. browse localhost, or 10.74.32.140. but when I try browse 10.74.32.140 on my windows PC. I only see text.

Lxw2015
Posts: 84
Joined: Fri Feb 12, 2016 4:05 am

Re: wordpress on pi

Fri Oct 11, 2019 11:04 pm

solved
I setup wordpress on my PC browser, rather than on my pi. then everything work as expected. both PC and PI show same page when visit 10.74.32.140 which is my pi's ip address.
the only difference is I config wordpress on pi before. and now I config wordpress on PC.
I don't know why. hope expert could shade some light.
thanks all for your help and response.

owardc
Posts: 1
Joined: Thu May 28, 2020 3:35 am

Re: wordpress on pi4 ( solved )

Thu May 28, 2020 3:39 am

I had the same issue as you and your solution fixed my issue. I think it has something to do with the URLs. When you set up Wordpress on the pi it uses "localhost" as your URL so only the Pi can access the Wordpress theme. When you set up Wordpress on a separate PC in the same network it uses the standard IP "192.168.x.xx". That's the only difference I could spot, hope this helps.

astrotutor
Posts: 31
Joined: Wed Feb 20, 2013 10:57 am

Re: wordpress on pi4 ( solved )

Thu Oct 08, 2020 3:44 pm

I have been doing the same exercise as well. It has taken me quite a while to find this answer that works. I just changed the localhost settings in the Dashboard on the Pi to the address of the Pi i.e. 192.168.1.xx. Saved and all worked great. I'll need to now make sure the IP address is fixed as opposed to dynamic now otherwise I presume it won't work.

Return to “General discussion”