PHP site no longer working on Heroku: error 500 - php

I'm trying to push an app that I wrote in vanilla PHP 7.2.1 to Heroku. I've developed in a local docker container with apache and mariaDB and things work fine. When I go to Heroku, the index page loads, but if I try to log in or go to any other page, nothing works and I get a blank page. I use the clearDB add on and simply imported my mariaDB .sql export file in there through CLI. The website uses URL rewriting, a router and a .htaccess.
I've read through other questions here and it seems like the problem could come from multiple angles. Unfortunately I'm new to a lot of this and I struggle understanding the error logs. I think either of these (or all) could be wrong:
possible issues due to the .htaccess
lack of composer.json file, so the server end of things is configured wrong
maybe a conflict in how the database is connected to the app
Based on the information below, what could / should I try to troubleshoot the app?
This is my .htaccess :
RewriteEngine On
RewriteRule ^([a-zA-Z0-9-_/]*)$ index.php?id=$1 [QSA,L]
This is the build log:
-----> PHP app detected
! WARNING: No 'composer.json' found!
! Your project only contains an 'index.php', no 'composer.json'.
! Using 'index.php' to declare app type as PHP is deprecated and
! may lead to unexpected behavior.
! Please consider updating your codebase to utilize Composer and
! modern dependency management in order to benefit from the latest
! PHP runtimes and improved application performance, as well as
! control over the PHP versions and extensions available.
! For an introduction to dependency management with Composer and
! how to get the most out of PHP on Heroku, refer to the docs at
! https://getcomposer.org/doc/00-intro.md and
! https://devcenter.heroku.com/articles/getting-started-with-php
-----> Bootstrapping...
-----> Installing platform packages...
NOTICE: No runtime required in composer.lock; using PHP ^7.0.0
- php (7.3.11)
- apache (2.4.41)
- nginx (1.16.1)
-----> Installing dependencies...
Composer version 1.9.0 2019-08-02 20:55:32
-----> Preparing runtime environment...
NOTICE: No Procfile, using 'web: heroku-php-apache2'.
-----> Checking for additional extensions to install...
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 18.5M
-----> Launching...
Released v5
https://cogip-becode.herokuapp.com/ deployed to Heroku
This is the application log:
2019-11-08T12:59:03.464108+00:00 heroku[router]: at=info method=GET path="/assets/css/style.css" host=cogip-becode.herokuapp.com request_id=527c0174-09a9-42c9-9a08-4253b4baa78d fwd="84.198.194.106" dyno=web.1 connect=1ms service=1ms status=304 bytes=128 protocol=https
2019-11-08T12:59:08.532874+00:00 heroku[router]: at=info method=POST path="/" host=cogip-becode.herokuapp.com request_id=d7eea251-3d27-49c5-bd54-75d9583b3dd4 fwd="84.198.194.106" dyno=web.1 connect=1ms service=3ms status=500 bytes=279 protocol=https
2019-11-08T12:59:08.533394+00:00 app[web.1]: [08-Nov-2019 12:59:08 UTC] PHP Notice: Undefined index: id in /app/index.php on line 4
2019-11-08T12:59:08.533891+00:00 app[web.1]: [08-Nov-2019 12:59:08 UTC] PHP Parse error: syntax error, unexpected 'cleardb' (T_STRING) in /app/database/connection.php on line 3
2019-11-08T12:59:08.534564+00:00 app[web.1]: 10.11.238.43 - - [08/Nov/2019:12:59:08 +0000] "POST / HTTP/1.1" 500 - "https://cogip-becode.herokuapp.com/" "Mozilla/5.0 (X11; Linux x86_64; rv:60.9) Gecko/20100101 Goanna/4.4 Firefox/60.9 PaleMoon/28.7.1

Related

Symfony randomly crash - DebugClassLoader.php

I have site based on symfony framework but on develop enviroment i have random crashes with exception: (with bad characters)
Warning: class_implements(): Class
���� does not exist and could not be loaded
or
Warning: class_implements(): Class H�d
���� does not exist and could not be loaded
or
ContextErrorException in DebugClassLoader.php line 203: Warning: class_implements(): Class multipart/form-data does not exist and could not be loaded
(php is not using symfony forms and request is GET)
or
OutOfMemoryException in DebugClassLoader.php line 203: Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1141972672 bytes)
(Memory limit is set on 128MB but for request is needed approximately 6MB)
All this different exceptions was thrown on one url with same parameter (for the testing purpose) so they are throwing randomly through whole web.
This bugs aren't on production enviroment only develop.
Develop enviroment is on windows 7 machine with XAMPP/apache.
If i restrat apache and press F5 everything is ok and web working ok.
I was trying clear all caches but without success.
Any ideas?
EDIT:
After activate OPCache the problem persists...
My config from symfony debug bar:
If i run command php bin/symfony_requirements from CLI
> PHP is using the following php.ini file:
C:\xampp7.0.9\php\php.ini
> Checking Symfony requirements:
...........................WW.......
[OK]
Your system is ready to run Symfony projects
Optional recommendations to improve your setup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* intl extension should be available
> Install and enable the intl extension (used for validators).
* a PHP accelerator should be installed
> Install and/or enable a PHP accelerator (highly recommended).
Note The command console could use a different php.ini file
~~~~ than the one used with your web server. To be on the
safe side, please check the requirements from your web
server using the web/config.php script.
I had the same problem with "Warning: class_implements(): Class ���� does not exist and could not be loaded"
I increased realpath_cache_size in php.ini and now apache works, no errors.

Unexpected error when installing WordPress plugins

I was installing civicrm and got an error while trying to install some wp plugin.
When trying to do it manually, I got the same error. It's been reported by others that this should work.
It happens for all plugins that I'm trying to install
I'm unable to figure out what could be wrong. I tried upgrading openssl and php5-curl as I read that online in some forum. Restarting apache didn't help either.
When I go to the "install plugin" page I get the same errors. Changing the timeout in wp-admin/includes/plugin-install.php for the function wp_remote_post() from 15 to 60 made it work. But that's not good as it's a core file. Also, themes dont work if I do this.
ajk#ajk-ThinkPad-R60:~/buildkit/build/wpmaster/wp-content/plugins$ wp plugin install civicrm-admin-utilities --debug
Debug: No readable global config found (0.029s)
Debug: Using project config: /home/ajk/Documents/civi/civicrm-buildkit/build/wpmaster/wp-cli.yml (0.034s)
Debug: ABSPATH defined: /home/ajk/Documents/civi/civicrm-buildkit/build/wpmaster/ (0.121s)
Debug: Begin WordPress load (0.121s)
Debug: wp-config.php path: /home/ajk/Documents/civi/civicrm-buildkit/build/wpmaster/wp-config.php (0.122s)
Debug: Loaded WordPress (0.724s)
Debug: Running command: plugin install (0.725s)
PHP Notice: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /home/ajk/Documents/civi/civicrm-buildkit/build/wpmaster/wp-admin/includes/plugin-install.php on line 158
PHP Stack trace:
PHP 1. {main}() /home/ajk/Documents/civi/civicrm-buildkit/bin/wp:0
PHP 2. include() /home/ajk/Documents/civi/civicrm-buildkit/bin/wp:4
PHP 3. include() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/boot-phar.php:5
PHP 4. WP_CLI\Runner->start() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/wp-cli.php:21
PHP 5. WP_CLI\Runner->_run_command() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/WP_CLI/Runner.php:723
PHP 6. WP_CLI\Runner->run_command() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/WP_CLI/Runner.php:320
PHP 7. WP_CLI\Dispatcher\Subcommand->invoke() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/WP_CLI/Runner.php:313
PHP 8. call_user_func() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/WP_CLI/Dispatcher/Subcommand.php:294
PHP 9. WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/WP_CLI/Dispatcher/Subcommand.php:294
PHP 10. call_user_func() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/WP_CLI/Dispatcher/CommandFactory.php:52
PHP 11. Plugin_Command->install() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/WP_CLI/Dispatcher/CommandFactory.php:52
PHP 12. WP_CLI\CommandWithUpgrade->install() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/commands/plugin.php:445
PHP 13. Plugin_Command->install_from_repo() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/WP_CLI/CommandWithUpgrade.php:141
PHP 14. plugins_api() phar:///home/ajk/Documents/civi/civicrm-buildkit/bin/wp/php/commands/plugin.php:297
PHP 15. trigger_error() /home/ajk/Documents/civi/civicrm-buildkit/build/wpmaster/wp-admin/includes/plugin-install.php:158
Warning: civicrm-admin-utilities: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.

505 Error Heroku Deploying Personal Website

I'm trying to host my personal website on heroku. My website only has html, css, and javascript files, and I read that heroku only deploys apps written in ruby, node, scala, php, etc. So, I followed this tutorial (http://www.lemiffe.com/how-to-deploy-a-static-page-to-heroku-the-easy-way/) and changed my index.html file to home.html and included an index.php file that has the following code: <?php include_once("home.html"); ?>.
I've successfully pushed it to heroku, but when I open the heroku url of my app, it gives me a 505 error.
Below is my heroku log:
2015-11-14T02:42:05.497208+00:00 heroku[api]: Deploy 63ae6bd by email#gmail.com
2015-11-14T02:42:05.497305+00:00 heroku[api]: Release v4 created by email#gmail.com
2015-11-14T02:42:05.651545+00:00 heroku[slug-compiler]: Slug compilation started
2015-11-14T02:42:05.651555+00:00 heroku[slug-compiler]: Slug compilation finished
2015-11-14T02:42:05.820048+00:00 heroku[web.1]: State changed from up to starting
2015-11-14T02:42:08.998026+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-11-14T02:42:09.746422+00:00 heroku[web.1]: Starting process with command `vendor/bin/heroku-php-apache2`
2015-11-14T02:42:09.909064+00:00 app[web.1]: Going down, terminating child processes...
2015-11-14T02:42:10.844965+00:00 heroku[web.1]: Process exited with status 0
2015-11-14T02:42:12.439647+00:00 app[web.1]: Starting php-fpm...
2015-11-14T02:42:12.243079+00:00 app[web.1]: Optimizing defaults for 1X dyno...
2015-11-14T02:42:12.435588+00:00 app[web.1]: 4 processes at 128MB memory limit.
2015-11-14T02:42:14.442033+00:00 app[web.1]: Starting httpd...
2015-11-14T02:42:14.672772+00:00 heroku[web.1]: State changed from starting to up
2015-11-14T02:44:38.663711+00:00 heroku[router]: at=info method=GET path="/" host=mywebsite.herokuapp.com request_id=45aae2bd-a6f8-4023-86cf-6aedd5d23882 fwd="138.110.234.184" dyno=web.1 connect=12ms service=2ms status=500 bytes=224
2015-11-14T02:44:38.663113+00:00 app[web.1]: [14-Nov-2015 02:44:38 UTC] PHP Parse error: syntax error, unexpected '?' in /app/index.php on line 1
2015-11-14T02:44:38.663580+00:00 app[web.1]: 10.146.233.83 - - [14/Nov/2015:02:44:38 +0000] "GET / HTTP/1.1" 500 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
You said 505 error (505 is really quite an exotic error!) but it is actually just a 500 error according to the log you pasted. 500 is the typical server side error, in this case:
PHP Parse error: syntax error, unexpected '?' in /app/index.php on line 1
I'd bet your php file has a space in it or something that isn't quite right. Make sure it looks like what you pasted as instructed here: https://stackoverflow.com/a/17531897/237091
Well , whenever your Web-page's contain HTML, CSS and JavaScript , so follow just 2 steps :
1) Make one file give name as index.html (keep evreything in it) ex:script,stylesheet & body.
2) Now, change these file, copy and paste these same file but change domain to index.php
Then deploy on a Heroku.
Hence this method will help you to deploy your Web-Pages

Trouble running local WordPress in Google App Engine

Following these instructions.
Installed MySQL, Python and Google App Engine PHP SDK on a Windows 8 PC. Perfect!
Created an app for WordPress, created database and user on localhost and edited WordPress config accordingly.
Started the app in the Google App Engine Launcher. Clicking Browse leads to blank page at http://localhost:8080/
Hmmm...
Checked logs, found
2013-11-26 17:56:18 Running command: "['C:\\Python27\\python.exe',
'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py',
'--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000',
'C:\\Users\\CsillamVilag\\Documents\\development-appengine\\arcfestesmintak']"
INFO 2013-11-26 17:56:19,805 devappserver2.py:660]
Skipping SDK update check.
WARNING 2013-11-26 17:56:19,813 api_server.py:331]
Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-11-26 17:56:19,822 api_server.py:138]
Starting API server at: http://localhost:53853
INFO 2013-11-26 17:56:19,826 dispatcher.py:171]
Starting module "default" running at: http://localhost:8080
INFO 2013-11-26 17:56:19,828 admin_server.py:117]
Starting admin server at: http://localhost:8000
INFO 2013-11-26 17:56:21,828 module.py:617] default: "GET / HTTP/1.1" 302 -
Pretty certain the Python for Windows package I used included PIL. Not sure where to go from here...
If I go to http://localhost:8080/wp-admin though, I get
Warning: chdir(): Invalid argument (errno 22) in C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\php\setup.php on line 42
Warning: require(wordpress/wp-admin/wp-admin/install.php): failed to open stream: No such file or directory in C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\php\setup.php on line 103
Fatal error: require(): Failed opening required 'wordpress/wp-admin/wp-admin/install.php' (include_path='C:\Users\CsillamVilag\Documents\development-appengine\arcfestesmintak;C:\Program Files (x86)\Google\google_appengine\php\sdk') in C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\php\setup.php on line 103
In the error returned at http://localhost:8080/wp-admin/ I see /wp-admin/wp-admin/install.php
Obviously install.php cant be found. It is in /wp-admin/ not in /wp-admin/wp-admin/
Not sure how to fix that.
If you are getting a blank page, you'll want to check your errors
In your /wordpress/wp_config.php file set
define('WP_DEBUG', false);
#ini_set('display_errors',0);
to
define('WP_DEBUG', true);
#ini_set('display_errors',1);
and see what is output when you go to
http://localhost:8080
Looks like Google App Engine doesn't support WordPress 3.7.1 (something that's not documented anywhere). Downgrading to WordPress 3.5.1 (the version mentioned in Google's instructions) made it work - http://localhost:8080 was forwarded to WordPress Install page.

PHP GAE not able to run SDK locally

I installed the latest SDK for php 1.8.1 and I am having trouble getting it to run locally
D:\google_appengine 1.8.1>dev_appserver.py --php_executable_path=D:\PHP\php-cgi.exe \Testing --port=5000
INFO 2013-06-13 03:16:30,931 sdk_update_checker.py:244] Checking for updates to the SDK.
INFO 2013-06-13 03:16:32,851 sdk_update_checker.py:260] Update check failed: HTTP Error 404: Not Found
**WARNING 2013-06-13 03:16:32,861 api_server.py:314] Could not initialize images API; you are likely missing the Python "PIL" module.**
INFO 2013-06-13 03:16:32,868 api_server.py:138] Starting API server at: http://localhost:60628
INFO 2013-06-13 03:16:32,874 dispatcher.py:164] Starting server "default" running at: http://localhost:5000
INFO 2013-06-13 03:16:32,878 admin_server.py:117] Starting admin server at: http://localhost:8000
ERROR:root:php failure (255) with:
X-Powered-By: PHP/5.4.16
Content-type: text/html
Warning: require_once(google/appengine/runtime/ApiProxy.php):
failed to open stream: No such file or directory in
D:\google_appengine 1.8.1\google\appengine
\tools\devappserver2\php\setup.php on line 21 INFO
2013-06-13 03:16:40,938 server.py:593] default: "GET / HTTP/1.1" 500 -
Fatal error: require_once(): Failed opening required
'google/appengine/runtime/ApiProxy.php' (include_path='D:\Testing') in
D:\google_appengine 1.8.1\google
\appengine\tools\devappserver2\php\setup.php on line 21
I am trying to find what the problem is but have no idea what is wrong. What is the PIL module I am missing?
The error says that ApiProxy.php is missing but it is located at
D:\google_appengine 1.8.1\php\sdk\google\appengine\runtime
Some one posted a similar issue and said they fixed it by doing the following
The problem is I also have a python version Google-App-engine. In
order to solve this this problem, I need to specify the
"dev_appserver" to PHP-GAE-SDK
I have no idea what that and will it fix the errors shown. Any thoughts?
Google seems to have messed up a little when they made the 1.8.1 revision on Windows. To fix it, go into this file:
D:\google_appengine 1.8.1\google\appengine\tools\devappserver2\php\runtime.py
You should find this at line 112:
if sys.platform == 'win32':
include_path = 'include_path=%s' % ';'.join(include_paths)
Change that to:
if sys.platform == 'win32':
include_path = 'include_path="%s"' % ';'.join(include_paths)
Note the extra pair of quotes around the %s.

Categories