Laravel 5 error. - php

I just uploaded my L5 project to host server. And this is the error that I'm getting.
Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' on line 50 this line is in index.php
This is the 50 line
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
Can I somehow change this line or make my project to php 5.5.32 version ? Because L5 framework using 5.6.25 and that sucks a little bit.

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);//This is line 50
the ::class is only supported since PHP 5.5
Ref:Laravel 4 inside Wamp does not work
Requirement:
http://laravel.com/docs/5.1/releases#laravel-5.1.4

Related

Laravel 7: Installing od FTP Server

I installed Laravel 7 on my FTP server, but I get this message
Parse error: syntax error, unexpected ':', expecting '{' in /vendor/symfony/polyfill-php80/bootstrap.php on line 23
When I used localhost everything was fine. What is wrong?
Laravel 7 require PHP >= 7.2.5. Check version installed on server.

Parse error: syntax error, unexpected '?' in /vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 233 - laravel

I have a subdomain folder running on php 7. Globally my php version is 5.6 actually. When i run my project, i get a 500 internal error. Checking my error_log, i see this error
Fatal error: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strpos() in /home/invoice/vendor/symfony/polyfill-mbstring/Mbstring.php on line 358
I tried to install this command composer require symfony/polyfill-icon in my subfolder (under the subdomain which is running on php 7) but then this is the result in the terminal
Warning: Ambiguous class resolution, "App\Http\Controllers\Auth\RegisterController" was found in both "/home/laravel/public_html/myproject/app/Http/Controllers/mNotify/Auth/RegisterController.php" and "/home/laravel/public_html/myproject/app/Http/Controllers/Auth/RegisterController.php", the first will be used.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
Parse error: syntax error, unexpected '?' in /home/laravel/public_html/myproject/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 233
When i look in the vendor file in my subfolder under the subdomain, the
Symfony\Polyfill\Mbstring\iconv is installed there but when i test from the terminal using php --ir iconv, it get Extension iconv is not present.
What is happening?
check if mod php < 7.0 has enabled to disabled it.
and enable mod php 7 or 7.1

CakePHP with PHPUnit fails when using command line testing

I'm using CakePHP 2.x and installed PHPUnit to do my testing.
Everything was working well until I uploaded my app to my hosting.
If I test it through the web (/test.php), it works fine.
But if I use cake test app XXXXXX, it gives me this error:
Configure::bootstrap() - CORE/Cake/Core/Configure.php, line 92
require - CORE/Cake/bootstrap.php, line 175
ShellDispatcher::_bootstrap() - CORE/Cake/Console/ShellDispatcher.php, line 136
ShellDispatcher::_initEnvironment() - CORE/Cake/Console/ShellDispatcher.php, line 98
ShellDispatcher::__construct() - CORE/Cake/Console/ShellDispatcher.php, line 54
ShellDispatcher::run() - CORE/Cake/Console/ShellDispatcher.php, line 65
[main] - CORE/Cake/Console/cake.php, line 49</pre></div></pre>
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /blablablablabla/cake/app/Vendor/PHPUnit/Autoload.php on line 71
In Autoload.php:
70. spl_autoload_register(
71. function ($class)
72. {
I didn't install PHPUnit though pear, I used the standalone plugin option (https://github.com/Hyra/PHPUnit-Cake2), but locally it works fine.
Any ideas?
Thanks!!
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in
/blablablablabla/cake/app/Vendor/PHPUnit/Autoload.php on line 71
Did you check what line or around line 71 of Autoload.php is? It clearly tells you that there is a syntax error.
Check if short tags are enabled locally but not on the server. If short tags are used in your application get rid of them. You don't want to use short tags for exactly the kind of issue you have right now.

Laravel 4: copy from local to live server

I am trying to copy a project from localhost to live server done in Laravel 4 framework.
On the local machine it is working, but I have this error in live server:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
/**********/laravel/bootstrap/autoload.php on line 46
Parse error: syntax error, unexpected T_STRING in
/**********/laravel/bootstrap/autoload.php on line 46
I didn't modify those files.
Thanks
At line 46 there is
Patchwork\Utf8\Bootup::initAll();
and php complaining for \ which means it doesn't supprt namespace, you have to upgrade to PHP 5 >= 5.3.0 because right now it's (on your live server) prior to PHP 5.3.0 and remember that laravel requires PHP >= 5.3.7 so upgrade your php version.

Symfony 2 and gits : How do i install that vendors library ?? I got errors

I'm trying to set up a Symfony dev platform on webfactionnal.
I'm using Git so when I download S2 I took th "without vendors" version and followed those instructions.
So everything went fine until step 8 :$ php bin/vendors install
I got several error messages when trying to execute this line on my server :
Warning: Wrong parameter count for parse_ini_file() in /home/quantum/webapps/quantumnetworks/bin/vendors on line 74
Warning: Invalid argument supplied for foreach() in
/home/quantum/webapps/quantumnetworks/bin/vendors on line 79 sh:
./vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php:
No such file or directory
Parse error: syntax error, unexpected T_STRING, expecting
T_CONSTANT_ENCAPSED_STRING or '(' in
/home/quantum/webapps/quantumnetworks/app/console on line 13
Parse error: syntax error, unexpected T_STRING, expecting
all the files are originals.
By the way, in the the /config.php I had that error : unable to read logs file, I've put it on 777 on my server and realize that it was named as log instead of logs ... why ?
Thanks !
T_CONSTANT_ENCAPSED_STRING or '(' in
/home/quantum/webapps/quantumnetworks/app/console on line 13
EDIT : I run php54 command to use php 5.4 as my hosting company advised me. But i still have some errors ,It download evrything, then i have
Installing/Updating AsseticBundle
and then come the error :
Receiving objects: 100% (1918/1918), 251.85 KiB | 447 KiB/s, done.
Resolving deltas: 100% (1164/1164), done.
61c9f363e73b4ecbb72f81eb62675260a1132048 HEAD is now at 41b5913 Merge
pull request #27 from stof/disable_profiler
Parse error: syntax error, unexpected T_STRING, expecting
T_CONSTANT_ENCAPSED_STRING or '(' in
/home/quantum/webapps/quantumnetworks/vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
on line 35
Parse error: syntax error, unexpected T_STRING, expecting
T_CONSTANT_ENCAPSED_STRING or '(' in
/home/quantum/webapps/quantumnetworks/app/console on line 13
Parse error: syntax error, unexpected T_STRING, expecting
T_CONSTANT_ENCAPSED_STRING or '(' in
/home/quantum/webapps/quantumnetworks/app/console on line 13
So yeah were making progress, almost done :)
EDIT2 :
I called my host company, they said , when you execute a script in php, even if you type php54, the script itself, if it starts another script, won't call it with the 5.4 version. TO fix that, here are the 4 steps :
cd ~/webapps<your application>
ln -s /usr/local/bin/php54 ./php
export PATH=./:$PATH
php54 bin/vendors install
need to do all of them
You are not using php 5.3, which is required to run Symfony2.
You can check on the console via
php -v
which version you currently use.
The T_CONSTANT_ENCAPSED_STRING or '(' in [...] is usually a hint, as php prior to 5.3 does not support Namespaces, which leads to syntax errors in older versions.

Categories