shannah / xataface

Framework for building data-driven web applications in PHP and MySQL
http://xataface.com
GNU General Public License v2.0
138 stars 58 forks source link

500 error in Lemp 16.04 with PHP7 #81

Open ebuy-4-you opened 7 years ago

ebuy-4-you commented 7 years ago

read of php info shows correct installation while index.php returns unable to handle this request. HTTP ERROR 500 with the correct credentials .The setup is over letsEncrypt SSL

shannah commented 7 years ago

Check your php error log to see what the actual error is.

On Mon, Jan 2, 2017 at 9:26 PM ebuy-4-you notifications@github.com wrote:

read of php info shows correct installation while index.php returns unable to handle this request.

HTTP ERROR 500 with the correct credentials .The setup is over letsEncrypt SSL

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/shannah/xataface/issues/81, or mute the thread https://github.com/notifications/unsubscribe-auth/ACjbOoj3yWuQ0Q2Wn8hQiiE10HjtfR3nks5rOdwDgaJpZM4LZWQN .

ebuy-4-you commented 7 years ago

No errors in log must be in my security settings but i can not figer it out

shannah commented 7 years ago

That is a problem if there are no errors in your error log. That error log is your only window into what PHP is doing. If there is a 500 error, it is reported in some log. Try creating a simple hello world php script, and confirm that it runs ok. Then try adding an intentional syntax error in that script, and see if it writes anything to your error log. If not, you need to find our where the error is written, and/or add configuration to direct it to your log.

ebuy-4-you commented 7 years ago

Hello World works fine when syntax error is given reports 500 again the thing is that i am not able to find where the error is my knowledge is limited ;)

shannah commented 7 years ago

See http://stackoverflow.com/questions/3531703/how-to-log-errors-and-warnings-into-a-file

Especially http://stackoverflow.com/a/30799288/2935174 and http://stackoverflow.com/a/3531765/2935174

On Tue, Jan 3, 2017 at 10:39 AM, ebuy-4-you notifications@github.com wrote:

Hello World works fine when syntax error is given reports 500 again the thing is that i am not able to find where the error is my knowledge is limited ;)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shannah/xataface/issues/81#issuecomment-270188650, or mute the thread https://github.com/notifications/unsubscribe-auth/ACjbOo1LtBJmdTjb2XnmYtv9vFMs41tsks5rOpXYgaJpZM4LZWQN .

-- Steve Hannah Web Lite Solutions Corp.

ebuy-4-you commented 7 years ago

huh this for Apache i am with Nginx the .htaccess i mean

shannah commented 7 years ago

I don't use NginX a lot, but there is a fair bit on info out there on how to set the PHP error log settings/location. E.g. http://stackoverflow.com/questions/8677493/php-fpm-doesnt-write-to-error-log http://serverfault.com/questions/417102/nginx-not-logging-php-errors http://askubuntu.com/questions/493197/unable-to-get-error-stack-trace-or-error-log-while-using-php-fpm-nginx-on-ubun

On Tue, Jan 3, 2017 at 10:44 AM, ebuy-4-you notifications@github.com wrote:

huh this for Apache i am with Nginx

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shannah/xataface/issues/81#issuecomment-270190050, or mute the thread https://github.com/notifications/unsubscribe-auth/ACjbOtUILk050YT9y4_rMOqWyZ8gDl3xks5rOpcggaJpZM4LZWQN .

-- Steve Hannah Web Lite Solutions Corp.

ebuy-4-you commented 7 years ago

thank you very much for your fast responds :) i thing the problem is Nginx's settings

ebuy-4-you commented 7 years ago

Uninstalling and reinstalling reading here and there with out any mod in any part i found this in Nginx's error log

``Stack trace:

0 /var/www/html/xataface/installer.php(533): xf_db_connect('localhost', 'root', 'XXXXXXXXXXXX...')

1 /var/www/html/xataface/installer.php(548): db()

2 {main}

thrown in /var/www/html/xataface/xf/db/drivers/mysql.php on line 2" while reading response header from upstream, client: 192.168.1.3, server: XXXXXXXXX.ga, request: "GET /xataface/installer.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXX.ga" 2017/01/03 22:40:13 [error] 1958#1958: *57 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/www/html/xataface/xf/db/drivers/mysql.php:2 Stack trace:

0 /var/www/html/xataface/installer.php(533): xf_db_connect('localhost', 'root', 'XXXXXXXXXXX...')

1 /var/www/html/xataface/installer.php(548): db()

2 {main}

thrown in /var/www/html/xataface/xf/db/drivers/mysql.php on line 2" while reading response header from upstream, client: 192.168.1.3, server: XXXXXXXXXX.ga, request: "GET /xataface/installer.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXX.ga" 2017/01/03 22:42:54 [error] 1958#1958: *57 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/www/html/xataface/xf/db/drivers/mysql.php:2

php7.0-fpm.log

[03-Jan-2017 19:53:48] NOTICE: fpm is running, pid 2047 [03-Jan-2017 19:53:48] NOTICE: ready to handle connections [03-Jan-2017 19:53:48] NOTICE: systemd monitor interval set to 10000ms [04-Jan-2017 00:44:19] NOTICE: Terminating ... [04-Jan-2017 00:44:19] NOTICE: exiting, bye-bye! [04-Jan-2017 00:50:14] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

shannah commented 7 years ago

Looks like you don't have the mysql extension installed. You should use the mysqli driver in that case http://xataface-tips.blogspot.ca/2014/06/using-mysqli-in-xataface.html

ebuy-4-you commented 7 years ago

Done replaced (remove) mysql driver with mysqli gave me this error

2017/01/05 02:19:39 [error] 1729#1729: *15 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(xf/db/drivers/mysql.php): failed to open stream: No such file or directory in /var/www/html/xataface/installer.php on line 531 PHP message: PHP Fatal error: require_once(): Failed opening required 'xf/db/drivers/mysql.php' (include_path='.:lib') in /var/www/html/xataface/installer.php on line 531" while reading response header from upstream, client: 192.168.1.3, server: XXXXXXXXX .ga, request: "GET /xataface/installer.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXX.ga"

then declared the driver in line 33 at /var/www/html/xataface/installer.php if ( !defined('XF_DB_DRIVER') ){ define('XF_DB_DRIVER','mysqli');

and of we go works like a charm :)

shannah commented 7 years ago

Did you add "driver=mysqli" to the app's conf.ini file?

The fact that it couldn't open the xf/db/drivers/mysql.php file means that either that file doesn't exist, or you have a permissions problem that is preventing the web process from accessing it. Directories in Xataface should be 0755, and PHP files should be 0644.

On Thu, Jan 5, 2017 at 7:08 AM, ebuy-4-you notifications@github.com wrote:

back again with first app :)

As of Xataface 1.3 all applications are now required to have its own templates_c directory to house its compiled templates. Please create the directory "/var/www/html/opencartdb/templates_c" and ensure that it is writable by the web server.

PHP message: PHP Fatal error: require_once(): Failed opening required '/var/www/html/xataface/public-api.php' (include_path='.:/usr/share/php') in /var/www/html/opencartdb/index.php on line 2" while reading response header from upstream, client: 192.168.1.3, server: xxxxxxxxxx.ga, request: "GET /opencartdb/index.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "xxxxxxxxxxx.ga"

When creating the templates_c file gives back this 500 error is the same like installing but this time is asking for for mysql driver that i had removed so i can make xataface working. Xataface index is display(); also the created app with xataface has a web.config file

2017/01/05 16:25:58 [error] 1657#1657: *206 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(xf/db/drivers/mysql.php): failed to open stream: No such file or directory in /var/www/html/opencartdb/ xataface/Dataface/Application.php on line 597 PHP message: PHP Fatal error: require_once(): Failed opening required 'xf/db/drivers/mysql.php' (include_path='.:/var/www/ html/opencartdb/xataface:/var/www/html/opencartdb/xataface/lib:/usr/share/php') in /var/www/html/opencartdb/xataface/Dataface/Application.php on line 597" while reading response header from upstream, client: 192.168.1.3, server: xxxxxxxxx.ga, request: "GET /opencartdb/index.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "xxxxxxxxx.ga"

and this is php7.0-fpm.log

[05-Jan-2017 02:03:46] NOTICE: fpm is running, pid 1792 [05-Jan-2017 02:03:46] NOTICE: ready to handle connections [05-Jan-2017 02:03:46] NOTICE: systemd monitor interval set to 10000ms [05-Jan-2017 04:34:40] NOTICE: Terminating ... [05-Jan-2017 04:34:40] NOTICE: exiting, bye-bye! [05-Jan-2017 04:40:30] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shannah/xataface/issues/81#issuecomment-270666046, or mute the thread https://github.com/notifications/unsubscribe-auth/ACjbOvJ7T3XISNb704Sl5Pcbt7GdwCBCks5rPQd4gaJpZM4LZWQN .

-- Steve Hannah Web Lite Solutions Corp.

ebuy-4-you commented 7 years ago

Step by step installing uninstalling reinstalling (now iam with 2.1.2 vertion) i managed after all these errors to see my apps first web screen :) but does not include all my conf.ini tables :( plus all the links are redirecting back to my main page

2017/01/06 00:21:45 [error] 1702#1702: *80 FastCGI sent in stderr: "PHP message: PHP Notice: Uninitialized string offset: -1 in /var/www/html/xataface/init.php on line 34 PHP message: PHP Warning: require_once(xf/db/drivers/mysql.php): failed to open stream: No such file or directory in /var/www/html/xataface/Dataface/Application.php on line 585 PHP message: PHP Fatal error: require_once(): Failed opening required 'xf/db/drivers/mysql.php' (include_path='.:/var/www/html/xataface:/var/www/html/xataface/lib:/usr/share/php') in /var/www/html/xataface/Dataface/Application.php on line 585" while reading response header from upstream, client: 192.168.1.3, server: XXXXXXXXXX.ga, request: "GET /xafacart/index.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXXX.ga" 2017/01/06 00:22:40 [error] 1702#1702: *80 FastCGI sent in stderr: "PHP message: PHP Notice: Uninitialized string offset: -1 in /var/www/html/xataface/init.php on line 34 PHP message: PHP Warning: require_once(xf/db/drivers/mysql.php): failed to open stream: No such file or directory in /var/www/html/xataface/Dataface/Application.php on line 585 PHP message: PHP Fatal error: require_once(): Failed opening required 'xf/db/drivers/mysql.php' (include_path='.:/var/www/html/xataface:/var/www/html/xataface/lib:/usr/share/php') in /var/www/html/xataface/Dataface/Application.php on line 585" while reading response header from upstream, client: 192.168.1.3, server: XXXXXXXXXX.ga, request: "GET /xafacart/index.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXXX.ga" 2017/01/06 00:29:40 [error] 1702#1702: *91 FastCGI sent in stderr: "PHP message: PHP Notice: Uninitialized string offset: -1 in /var/www/html/xataface/init.php on line 34" while reading response header from upstream, client: 192.168.1.3, server: XXXXXXXXXX.ga, request: "GET /xafacart/index.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXXX.ga" 2017/01/06 00:32:30 [error] 1705#1705: *100 FastCGI sent in stderr: "PHP message: PHP Notice: Uninitialized string offset: -1 in /var/www/html/xataface/init.php on line 34" while reading response header from upstream, client: 173.252.90.119, server: XXXXXXXXXX.ga, request: "GET /xafacart/index.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXXX.ga" 2017/01/06 00:32:45 [error] 1704#1704: *121 FastCGI sent in stderr: "PHP message: PHP Notice: Uninitialized string offset: -1 in /var/www/html/xataface/init.php on line 34" while reading response header from upstream, client: 31.13.112.122, server: XXXXXXXXXX.ga, request: "GET /xafacart/index.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXXX.ga" 2017/01/06 00:32:46 [error] 1704#1704: *123 FastCGI sent in stderr: "PHP message: PHP Notice: Uninitialized string offset: -1 in /var/www/html/xataface/init.php on line 34" while reading response header from upstream, client: 31.13.114.54, server: XXXXXXXXXX.ga, request: "GET /xafacart/index.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXXX.ga" 2017/01/06 00:32:48 [error] 1704#1704: *125 FastCGI sent in stderr: "PHP message: PHP Notice: Uninitialized string offset: -1 in /var/www/html/xataface/init.php on line 34" while reading response header from upstream, client: 173.252.115.164, server: XXXXXXXXXX.ga, request: "GET /xafacart/index.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXXX.ga", referrer: "http://l.facebook.com/lsr.php?u=https%3A%2F%2FXXXXXXXXXX.ga%2Fxafacart%2Findex.php%23&ext=1483655866&hash=Acm7-oV5ZBxQoO_EOJvYKhMiHlH1ta6YDg4EUANIiUI3XA" 2017/01/06 00:35:23 [error] 1702#1702: *152 FastCGI sent in stderr: "PHP message: PHP Notice: Uninitialized string offset: -1 in /var/www/html/xataface/init.php on line 34" while reading response header from upstream, client: 5.54.20.64, server: XXXXXXXXXX.ga, request: "GET /xafacart/index.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXXX.ga", referrer: "https://l.facebook.com/l.php?u=https%3A%2F%2FXXXXXXXXXX.ga%2Fxafacart%2Findex.php%23&h=xAQHziFpA&s=1" 2017/01/06 00:54:38 [error] 1702#1702: *157 FastCGI sent in stderr: "PHP message: PHP Notice: Uninitialized string offset: -1 in /var/www/html/xataface/init.php on line 34" while reading response header from upstream, client: 192.168.1.3, server: XXXXXXXXXX.ga, request: "GET /xafacart/index.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XXXXXXXXXX.ga", referrer: "https://XXXXXXXXXX.ga/xafacart/index.php"

shannah commented 7 years ago

Download the latest from github https://github.com/shannah/xataface/archive/master.zip

Version will be 2.2.0