I'm using a slimframwork 3 app on laradock (nginx, mariadb, phpfpm, php 5.6) so I made a stupid syntax error:
$view->addExtension(new \Slim\Views\TwigExtension(
$container->router,
$container->request->getUri(),
));
the comma after the getUri() was giving me error 500 on chrome and that was frustration so I tried my app on wamp on windows and I get:
Parse error: syntax error, unexpected ')' in C:\wamp64\www\app\bootstrap\app.php on line 21
why was I having a 500 error with no clue of what was wrong.
P.S. I've set displayErrorDetails to true
Shoutout to Phil who solved this issue.
So when you use laradock and you come to a situation like this and you want more specific details about the error, you can either check your php-fpm container logs with:
docker logs -f <your container>
or set the "display_errors=On" on laradock/php-fpm/laravel.ini
and you'll see your error message on your browser instead of error 500.
Related
I am using tomcat8.5, apache2, php7.25 on ubuntu 18.04
I installed php on my computer and did other configurations and installed required libraries. In the first day it worked fine and I could run a php script properly on localhost.
But next day when I tried to run the same php file I got this error.
Type Exception Report
Message Could not connect to server. Please start it with: cd /home/dr3am/Documents/phphome/WEB-INF/cgi/amd64-linux
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
php.java.fastcgi.ConnectionException: Could not connect to server. Please start it with: cd /home/dr3am/Documents/phphome/WEB-INF/cgi/amd64-linux
REDIRECT_STATUS=200 X_JAVABRIDGE_OVERRIDE_HOSTS="/" PHP_FCGI_CHILDREN="5" PHP_FCGI_MAX_REQUESTS="500" php-cgi -b 127.0.0.1:9669
php.java.fastcgi.SocketFactory.test(SocketFactory.java:73)
php.java.fastcgi.FCGIFactory.startFCGIServer(FCGIFactory.java:99)
php.java.fastcgi.FCGIConnectionPool.createConnectionPool(FCGIConnectionPool.java:147)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:220)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:209)
php.java.servlet.fastcgi.FastCGIServlet.doExecute(FastCGIServlet.java:374)
php.java.servlet.fastcgi.FastCGIServlet.execute(FastCGIServlet.java:468)
php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:479)
php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause
java.net.ConnectException: Connection refused (Connection refused)
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
java.net.Socket.connect(Socket.java:607)
java.net.Socket.connect(Socket.java:556)
java.net.Socket.<init>(Socket.java:452)
java.net.Socket.<init>(Socket.java:262)
php.java.fastcgi.SocketFactory.test(SocketFactory.java:67)
php.java.fastcgi.FCGIFactory.startFCGIServer(FCGIFactory.java:99)
php.java.fastcgi.FCGIConnectionPool.createConnectionPool(FCGIConnectionPool.java:147)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:220)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:209)
php.java.servlet.fastcgi.FastCGIServlet.doExecute(FastCGIServlet.java:374)
php.java.servlet.fastcgi.FastCGIServlet.execute(FastCGIServlet.java:468)
php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:479)
php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note The full stack trace of the root cause is available in the server logs.
I didn't change any configuration file or removed any required library. But suddenly I got this error. I looked for solutions but I found nothing related to my problem.
What is the reason for this and how to solve it?
this is probably something simple but I have a problem with my local server. I set up a local server for building websites about 3 months ago and it worked fine until last evening the php will show as text instead of being executed by apache. I'm on a Mac. When I type:
$ apachectl -S
in terminal I get this error:
httpd: Syntax error on line 173 of /usr/local/etc/httpd/httpd.conf: Cannot load /usr/local/Cellar/php56/5.6.32_8/libexec/apache2/libphp5.so into server: dlopen(/usr/local/Cellar/php56/5.6.32_8/libexec/apache2/libphp5.so, 10): image not found
I have not been able to find a solution. Any help is appreciated.
I use CentOS 7 for a little pjojekt with Docker and Laravel. Used a tutorial (https://tecadmin.net/install-laravel-framework-on-centos/#) for the instalation and I dont dont know why but something gone wrong within the 5th Step. The terminal says this:
[root#docker laravel]# php artisan key:generate
PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/laravel/artisan on line 31
And in the artisan line 31 is this:
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
If someone has an idea the please help.
I want after installing Laravel combine Docker and Laravel with Laradock i hope this will not go wrong like this
Thanks Moritz
I had the same error, for me it was a permission issue.
From the laravel docs(source: https://laravel.com/docs/5.4/installation):
Directory Permissions
After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run.
So try changing the permissions on your host machine and see if it works.
After upgrading to Laravel 5.1 from 5.0, I'm having problems with AWS S3.
I created a test route to verify that S3 was working and it seems that is is not:
get('/test', function() {
return Storage::disk('s3')->exists('temp/file.jpg') ? 'true' : 'false';
});
The following error is returned:
S3Exception in WrappedHttpHandler.php line 152:
Error executing "HeadObject" on "https://s3.amazonaws.com/rugapp/temp/file.jpg"; AWS HTTP error: Client error response [url] https://s3.amazonaws.com/app/temp/file.jpg [status code] 403 [reason phrase] Forbidden (client): 403 Forbidden
After doing some research, it seems this issue may or may not be related to HHVM. I am using Laravel Homestead which runs the following:
Ubuntu 14.04
PHP 5.6
HHVM
Nginx
After reading this, I upgraded HHVM to 3.8-dev and restarted Nginx. The problem remained.
Does anyone have any insight on how to resolve this problem?
UPDATE: It seems to work fine now but I'm not sure why. I haven't made any changes overnight. Strange.
Similar issue happens in my local homestead development while my app running on Linode works fine.
After checking S3 permission, checked out old version, etc., this problem disappear when I restart homestead.
homestead halt
homestead up --provision
I had this same error. I believe it happened because I switched wireless networks as I was developing. After restarting the virtual machine, the error went away.
I'm trying to build php_perl.dll and am getting errors, but my understanding of building these extensions is limited (obviously). So i need to get this compiled, or, alternatively, point me to a pre-built php_perl.dll that will work with PHP 5.2.17. The http://pecl4win.php.net site is dead, and what little i can find at http://pecl.php.net/package/perl isn't much help either.
I've installed Perl (tried 64bit then x86), PHP (installed with XAMPP), and Visual Studio 6. Windows 7 64bit. PERL_HOME set to c:\perl.
This command
msdev perl.dsp /MAKE "perl - Win32 Release_TS"
Results in 102 errors, like this:
--------------------Configuration: perl - Win32 Release_TS--------------------
Compiling...
php_perl.c
C:\Perl\lib\CORE\sys/socket.h(72) : error C2061: syntax error : identifier 'win32_accept'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ';'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2146: syntax error : missing ')' before identifier 's'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2061: syntax error : identifier 's'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ','
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ')'
...
C:\Perl\lib\CORE\sys/socket.h(98) : error C2059: syntax error : ')'
C:\Perl\lib\CORE\win32.h(420) : error C2079: 'Wservent' uses undefined struct 'servent'
C:\Perl\lib\CORE\iperlsys.h(1143) : error C2143: syntax error : missing ')' before '*'
C:\Perl\lib\CORE\iperlsys.h(1143) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.
php_perl.dll - 102 error(s), 0 warning(s)
Any ideas on what i'm doing wrong?
No answer for this question?
I just resolved compilation errors for php 5.3.13 on Windows by slightly modifying the new 1.0.1 php_perl.c source code (line 31):
old:
# define _WINSOCK2API_ /* using winsock.h instead of winsock2.h */
new:
# ifndef _WINSOCK2API_
# include <winsock2.h>
# endif
For the compilation follow the tutorial from this page (http:/ /www.crazyws.fr/tutos/compiler-php-et-ses-extensions-sur-windows-SJ5GT.html), sorry for the french.
Basically install Visual Studio 2008 Express WITH SP1 (otherwise a build error occurs), then uninstall any 2008 Runtime, then install the Windows SDK 6.1 (2008 Server) to compile VC9 builds. I also used a Perl installation from ActiveState (version 5.8.0, ActivePerl-5.8.0.805-MSWin32-x86.msi, not tested with further versions).
Then download the php sdk and deps from http:/ /windows.php.net/downloads/php-sdk/, php sources, sources of extension from http:/ /pecl.php.net/package/perl, unzip directories as described in the tutorial, modify php_perl.c as above.
Then open the CMD shell of the Windows SDK and type:
setenv /xp /x86 /release
cd <root_directory>
bin\phpsdk_setvars.bat
cd <php_src>
buildconf --force
configure --help
configure --with-perl=shared --with-extra-includes="<perl_lib_CORE_directory>" --with-extra-libs="<perl_lib_CORE_directory>"
nmake php_perl.dll
I compiled my dll on windows 7 Pro 64-bit and tested it on my WampServer installation. The .phpt files in the sources of the extension are pretty self-explanatory on how to use it.
For info another version of the file is also available for php 5.4 on this github repo (https:/ /github.com/do-aki/php-ext-perl).
Sorry for the long answer, but the README file of the extension regarding installation on Windows is obsolete and there is no support which I found pretty lame.
Regards