Json error: Cannot modify header information – headers already sent on Aws-bitnami

Inquiries regarding logs in the following format are probably the most common due to json errors related to WordPress.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>[Thu Jul 25 13:00:50.367263 2024] [proxy_fcgi:error] [pid 26574:tid 140437025085120] [client xxx.it.is.myIp:50810] AH01071: Got error '; PHP message: PHP Warning: Cannot modify header information - headers already sent in /opt/bitnami/apache/htdocs/MY-WEB-1stDOMAIN-FOLDER/wp-includes/rest-api/class-wp-rest-server.php on line 1831; PHP message: PHP Warning: Cannot modify header information - headers already sent in /opt/bitnami/apache/htdocs/MY-WEB-1stDOMAIN-FOLDER/wp-includes/rest-api/class-wp-rest-server.php on line 1831;
</code>
<code>[Thu Jul 25 13:00:50.367263 2024] [proxy_fcgi:error] [pid 26574:tid 140437025085120] [client xxx.it.is.myIp:50810] AH01071: Got error '; PHP message: PHP Warning: Cannot modify header information - headers already sent in /opt/bitnami/apache/htdocs/MY-WEB-1stDOMAIN-FOLDER/wp-includes/rest-api/class-wp-rest-server.php on line 1831; PHP message: PHP Warning: Cannot modify header information - headers already sent in /opt/bitnami/apache/htdocs/MY-WEB-1stDOMAIN-FOLDER/wp-includes/rest-api/class-wp-rest-server.php on line 1831; </code>
[Thu Jul 25 13:00:50.367263 2024] [proxy_fcgi:error] [pid 26574:tid 140437025085120] [client xxx.it.is.myIp:50810] AH01071: Got error '; PHP message: PHP Warning:  Cannot modify header information - headers already sent in /opt/bitnami/apache/htdocs/MY-WEB-1stDOMAIN-FOLDER/wp-includes/rest-api/class-wp-rest-server.php on line 1831; PHP message: PHP Warning:  Cannot modify header information - headers already sent in /opt/bitnami/apache/htdocs/MY-WEB-1stDOMAIN-FOLDER/wp-includes/rest-api/class-wp-rest-server.php on line 1831;

In my case, the error log is related to ‘the Invalid JSON Error'(or ‘Receiving JSON error when trying to upload images’). I already know some general advice for solving this problem. And I tried running it.

For example:

  1. Consider plugin conflicts on your WordPress. So I turned off/deactivate all plugins and review them one by one.

  2. Consider the unique link of the post on your WordPress setting panel. So I tried changing from a general unique link to a unique link of the post title format(or reverse).

  3. Remove whitespace in PHP code. So I tried removing spaces from my custom function files(ex: function.php of theme child). And I even tried manually replacing all WordPress resource files through FTP.

  4. Regenerate WordPress .htaccess File. So I regenerated .htaccess by WordPress’ default.

  5. and etc…

But it wasn’t resolved. So I thought this was a problem with the web server’s absolute path or redirection. This is because this problem occurred after migrating to the Aws Bitnami server.

As those of you who have used it know, bitnami’s LAMP service currently provides a web root to the ‘/opt/bitnami/apache/htdocs/’ path. It means ‘htdocs’ is of a base web directory for a static ip. And in ‘httpd.conf’ or ‘bitnami.conf’, this default/base directory is received as web http. And then host user can be distributed to multisites’ domain directories through ‘vhost.cof’. (MY-WEB-1stDOMAIN-FOLDER, MY-WEB-2ndDOMAIN-FOLDER, MY-WEB-3rdDOMAIN-FOLDER…)

And between this structure, URLs are processed by intervening in the certificated domain address through ‘ssl.conf’.

So,

  1. So, I also reviewed the files that process this domain URL and address several times.

  2. Of course, I also applied all permissions for the WordPress directory, in which bitnami engineer suggest. (ex: chown -R bitnami:daemon ‘htdocs’ or ‘MY-WEB-1stDOMAIN-FOLDER’)

However, I cannot eliminate errors that appear in ‘Receiving JSON error when trying to upload images’ or in that error.logs file.

This error usually occurs when editing a WordPress post. This doesn’t happen with every post. It happens on some posts and not on others (I’ve heard it’s an issue related to WordPress’s Gutenberg block editor). However, regardless of Gutenberg, that Json errors occur 100% when uploading images.

There is no problem editing posts, uploading and saving images. That error just pops up.

Some recommend the classic editor plugin of WordPress, but I don’t want to deal with this problem that way.

I can’t help but think that it is a design flaw of Editor in WordPress(or bitnami?) that the error does not go away even after various reviews and actions. what do you think? (Is there a way to solve this problem by adjusting/changing Bitnami’s path?)

Please note, I did not use the (multi) WordPress app provided by Bitnami package, but I manually installed each WordPress in each folder on the LAMP instance. (In addition to WordPress 6.6.1, which I installed myself, all versions PHP 8.x, MariaDB 10.x… provided by AWS are the latest versions.)

Thank you in advance for your comment.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật