Comments on: Raspberry Pi: Install Apache + MySQL + PHP (LAMP Server) https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Mon, 21 Apr 2025 09:39:09 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/#comment-1029366 Mon, 21 Apr 2025 09:39:09 +0000 https://randomnerdtutorials.com/?p=89427#comment-1029366 In reply to Kev.

Hi.
Thanks for your comment.
We have to revisit this tutorial.
Regards,
Sara

]]>
By: Kev https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/#comment-1028409 Fri, 18 Apr 2025 04:48:17 +0000 https://randomnerdtutorials.com/?p=89427#comment-1028409 after struggling with the -1 error I put the code into Grok to analyse and it came up with the following and fixed the issues
……………………………………………………………………………………………..
Key Observations and Issues in the ESP32 Code
Mixed Content-Type Headers and Incorrect POST Data:
The code sets the Content-Type header twice:
First as application/x-www-form-urlencoded for the intended POST data (httpRequestData).

Then as application/json for a test JSON payload ({“value1″:”19″,”value2″:”67″,”value3″:”78”}).

Only the JSON payload is sent (https.POST(“{\”value1\”:\”19\”,\”value2\”:\”67\”,\”value3\”:\”78\”}”)), which doesn’t match the PHP script’s expectations. The PHP script expects application/x-www-form-urlencoded data with specific fields (api_key, Sensor, Station, Water_T, etc.).

The httpRequestData string, which contains the correct sensor data, is constructed but commented out and never sent.

Fix:
Remove the JSON test payload and send the httpRequestData with the correct Content-Type.

Update the POST request to use httpRequestData:

also with the Wifi method

WiFiClientSecure Misuse:
The code creates a new WiFiClientSecure object in the loop() function (WiFiClientSecure *client = new WiFiClientSecure;), which is unnecessary since a global client is already defined. This can lead to memory leaks or connection issues.

The global client is initialized in the global scope (WiFiClientSecure *client = new WiFiClientSecure;), but the loop() creates a new local instance, which shadows the global one.

Fix:
Remove the local client declaration in loop() and use the global client.

Move the setInsecure() call to setup() since it only needs to be set once.

Server URL and Network Issues:
The serverName is set to 192.**..***/post-Lake-Data.php, which is a local IP address. If the ESP32 and the server are not on the same network, or if the server is not reachable at this IP, the connection will fail, resulting in a -1 error.

The use of WiFiClientSecure with setInsecure() suggests the code is prepared for HTTPS, but the URL uses HTTP (192.**..***/post-Lake-Data.php). If the server expects HTTPS, this mismatch could cause a connection failure.

Fix:
Ensure the server is accessible at 192.**..*** from the ESP32’s network.

If the server uses HTTPS, update the URL to https://192.***.*.***/post-Lake-Data.php. If it’s HTTP, switch to WiFiClient instead of WiFiClientSecure:

]]>
By: Malinguer https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/#comment-997352 Sun, 05 Jan 2025 17:09:39 +0000 https://randomnerdtutorials.com/?p=89427#comment-997352 I am trying to log in to phpMyAdmin remotely as I am running my RPI headlessly. Have tried all combinations of my root user name on the RPI and passwords without luck. As I am remotely and not on localhost, I must be doing something wrong. Any suggestions?

]]>
By: Steve Spence https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/#comment-939765 Sat, 20 Jul 2024 13:54:40 +0000 https://randomnerdtutorials.com/?p=89427#comment-939765 when running mysql_secure_installation, you will get asked to switch to unix_socket authentication. If you have already password protected your root account, you can say no.

]]>
By: Steve Spence https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/#comment-939764 Sat, 20 Jul 2024 13:52:33 +0000 https://randomnerdtutorials.com/?p=89427#comment-939764 In optional setup replace pi: with $USER, as recent PI OS images do not use pi as the default user name.

]]>
By: Dr Dave https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/#comment-924854 Thu, 13 Jun 2024 05:13:45 +0000 https://randomnerdtutorials.com/?p=89427#comment-924854 In reply to Andrew Longdon.

I had the same problem, it’s because you may have chosen a root password in Maria Db that phpmyadmin decides is insecure. You need to reset the password to something more secure…. digitalstartup.co.uk/t/cannot-log-in-to-phpmyadmin-ubuntu-server/374

]]>
By: benikum https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/#comment-913216 Mon, 06 May 2024 19:02:42 +0000 https://randomnerdtutorials.com/?p=89427#comment-913216 Hey, almost everything worked perfectly for me, except that I get an error whenever I want to open the priveleges tab on my database.

It says:
#1267 – Illegal mix of collations (utf8mb4_general_ci,COERCIBLE) and (utf8mb4_unicode_ci,COERCIBLE) for operation ‘<>’

And it would’nt go away :c

]]>
By: Ian https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/#comment-912725 Sun, 05 May 2024 10:58:43 +0000 https://randomnerdtutorials.com/?p=89427#comment-912725 All sorted now.
Reinstalled everything from scratch and got the phpmyadmin login page but still could not login.
Hours of research and finally got the clues here.
https://forums.raspberrypi.com/viewtopic.php?t=222100
$ sudo mysql;
MariaDB [mysql]> select * from mysql.user;
No admin user!!
MariaDB [mysql]> CREATE USER ‘admin’@’localhost’ IDENTIFIED BY ‘password’;
MariaDB [mysql]> GRANT ALL PRIVILEGES ON . to ‘admin’@’localhost’ WITH GRANT OPTION;
All sorted. Ian

]]>
By: Ian https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/#comment-912423 Sat, 04 May 2024 11:16:10 +0000 https://randomnerdtutorials.com/?p=89427#comment-912423 Hi I followed all of the above for a R pi 5 and all appeared to go well until I installed phpmyadmin.
I followed the scripts as above but when I tried to access from my browser I just get a blank page with no comments, errors or phpmyadmin.
Please help!
Any debug suggestions?
Can I uninstall phpmyadmin and try again?
Best wishes, Ian

]]>
By: James https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/#comment-834491 Sat, 13 May 2023 00:40:35 +0000 https://randomnerdtutorials.com/?p=89427#comment-834491 Hi, instead of seeing the phpMyAdmin web interface, I get an “Forbidden
You don’t have permission to access this resource.” error.
Does anyone have an idea on how to fix it or on what did I do wrong?
Thanks!

]]>