I'm trying to install codeigniter bonfire. After clicking the install button on the create username screen, it takes a few moments and then it loads this page. I watched some tutorials on how to install bonfire so I know this isn't what I should be seeing.
Regardless, I updated the RewriteBase to /bonfire/ as it says..and now I'm getting this error when I try to go to localhost/bonfire/index.php
Parse error: syntax error, unexpected 'yield' (T_YIELD), expecting
identifier (T_STRING) in
/opt/lampp/htdocs/bonfire/bonfire/application/libraries/template.php
on line 305
Here's the code at line 305
public static function yield()
{
$output = '';
if (self::$debug) { echo 'Current View = '. self::$current_view; }
self::load_view(self::$current_view, NULL, self::$ci->router->class .'/'. self::$ci->router->method, FALSE, $output);
Events::trigger('after_page_render', $output);
return $output;
}//end yield()
I found this link on bonfire forums explaining the error.
Bonfire forums link
It says to use PHP 5.4 and that's what I'm using. My operating system is Linux Zorin and I'm using lampp, so I'm not sure if this could be a permissions issue.
thx in advance and please let me know if you need more info.
a bit late but hopefully help.
You can change the name for static function yield in cibonfire, something like this:
public static function yield()
to:
public static function yield_content()
this works perfectly to me.
I think in the LAMP the version of PHP is 5.5 + Something. IN PHP 5.5 there is a function name as yield so you have to downgrade your LAMP PHP version to 5.4 or modify in the Bonfire file system.
For change in Bonfire You can Go through this link and your problem has been solved.
https://github.com/illuminate/view/commit/d37abcecc7d79d00bf5f22b134d152ca765f26b2
You can also Review this link Laravel 4 syntax error out-of-the-box
Related
I am currently working on an application in symfony 4. I encounter a problem for deploy in prod. when I get to the navigator I get this error :
Fatal error: Default value for parameters with a class type can only be NULL in /var/www/html/project/vendor/symfony/config/ResourceCheckerConfigCache.php on line 40.
public function __construct(string $file, iterable $resourceCheckers = array())
{
$this->file = $file;
$this->resourceCheckers = $resourceCheckers;
}
I specify that the site works perfectly with the dev server (php bin /console server:start)
The problem must come from the environment. in the .env file, when I set APP_ENV=dev , in the browser there is only a blank page with a status 500 (no message in the logs)
I can not find any documentation on the internet and I am starting to lack ideas. If someone has a solution I am interested.
Thank you.
Solution by OP.
The problem was that the PHP version was PHP 7.0 and not 7.1. Though in my shell the php -v command was fine with 7.1, I noticed the wrong version used by phpinfo ();
I just pushed a Laravel website onto a shared hosting. Copied the public folder to the /www, changed the index.php to reflect the path change and configured my .htaccess, etc.
At first I was simply getting an error, telling me that Page::findBySlug() returned null. Checked again with dd(), was and still is null.
FrontendController#index is looking like this
public function index($slug)
{
$page = Page::findBySlug($slug);
$pageTemplate = $page->templates->first();
return view('frontend.pages.index', compact('page','pageTemplate'));
}
and after toying with dd() for a while, it now sends me to the custom 500 unless it's supposed to pull the slug from db, in which case I get a custom 404.
EDIT: I pulled the same version of the app but with it being already installed (instead of rolling with composer instal) from the testing platform and it simply works so I doubt it has anything to do with the hosting. I'd still appreciate an answer given that I'd like to do it the correct way. Is there anything I should setup slugs-wise after running a fresh install?
What am I missing here? Thanks.
Try $page= Page::where('slug',$slug)->first();
Try to update your php veersion to 7.0 .
Fixed by php artisan route:clear.
Apparently route:cache wasn't the way to go.
I recently did the blog tutorial for CakePHP, as is found here: http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/blog.html
I have CakePHP version 2.8.5, and WampServer with Apache 2.4.9, PHP 5.5.12 and MySQL 5.6.17, and got the blog running on localhost/.
I am now trying to upload the blog to a server online, and have used SmartFTP to upload files to the folder public_html on a free web server online, but when I visit the domain, I receive:
Parse error: syntax error, unexpected T_STATIC, expecting T_STRING or T_VARIABLE or '$' in /home/a3087838/public_html/lib/Cake/Core/App.php on line 221
Line 221 is:
if (!empty(static::$legacy[$type])) {
which is part of:
public static function path($type, $plugin = null) {
if (!empty(static::$legacy[$type])) {
$type = static::$legacy[$type];
}
I have seen similar questions asked online, but the solution seems to be that PHP version 5.3 or greater is required as prior versions don't support late static binding, but my version is 5.5.12, so I shouldn't have that problem.
I tried replacing the word static with self, but the error then just reiterates itself for later lines containing static. I repeated this down to line 282 and it's behaviour didn't change. I could replace all other instances of static with self, but that will take a while and I expect there is a better solution that I am missing, if that is even a solution. I am inexperienced and any help would be appreciated.
After following the user guide instructions found here: http://ellislab.com/codeigniter/user-guide/general/cli.html I'm unable to run the test script via command line.
My controller located at /var/www/mysite/application/controllers/
class Tools extends CI_Controller {
public function message($to = 'World')
{
echo "Hello {$to}!".PHP_EOL;
}
}
In my browser I can access
http://mysite/tools/message/ben
And the function correctly outputs "Hello ben"
From terminal I should be able to run:
$ php index.php tools message "Ben"
My terminal should print: "Hello Ben"
However I get the following error:
PHP Fatal error: Class 'CI_Controller' not found in /var/www/mysite/system/core/CodeIgniter.php on line 233
My server is pretty standard; ubuntu LAMP. Codeigniter is pretty standard too and I have no problem running non CI scripts via command line
My PHP binary is only located in /usr/bin/php <-- This post suggests an issue running CI directly from usr/bin/php, however I'm not operating a shared PHP service, and I don't see why this would make a difference to how PHP executes a CI script.
Any help or just an indication on how to debug this would be greatly appreciated.
Thanks in advance.
Solved! (partly) the issue was CodeIgniters error logging.
In application/config/config.php, I modified the following config property:
$config['log_threshold'] = 0;
This disables logging, and allows $ php index.php to execute.
If anyone can explain why CI only shows this error on CLI PHP - might help anyone else who has this issue and needs it resolved with error logging on.
To solve error "Class 'CI_Controller' not found" try going to Application -> Config -> database.php then check the database details like hostname, username, password and database.
To Mijahn:
I had this same problem, and after about two hours of tracing through code to figure out the problem, it seems that there is some sort of conflict with loading the CI_Controller when utilizing the native PHP load_class function.
I worked around this issue by making the following changes to the Common.php file (hack, I know).
//$_log =& load_class('Log');
require_once('system/libraries/Log.php');
$_log = new CI_Log();
My logs then where created exactly like I wanted. Hope this hack helps.
This site says to run codeigniter from the command line, one must set the $_SERVER['PATH_INFO'] variable.
$_SERVER['PATH_INFO'] is usually supplied by php when a web request is made. However, since we are calling this script from the command line, we need to emulate this small part of the environment as a web request.
The answer provided in this Stack Overflow post worked for me.
Within system/core/CodeIgniter.php, on around line 75, change:
set_error_handler('_exception_handler');
to...
set_exception_handler('_exception_handler');
Other users have reported that this gave them a better backtrace with which to debug the underlying issue, but for me, this actually removed the problem altogether.
I have weird issue with CodeIgniter,
here is a start part of my controller
class Home extends Controller
{
/**
* Constructor
*/
public function __construct() {
parent::Controller();
}
...
everything is working fine at localhost, but when I try same at server, I come cross with an error like below:
Parse error: syntax error, unexpected
T_STRING, expecting T_OLD_FUNCTION or
T_FUNCTION or T_VAR or '}' in
/home3/blabla/public_html/blablabla/applications/frontend/controllers/home.php
on line 22
I researched and people say it is about PHP4.. it should be PHP5. but my server has PHP5 on. what can be the reason?
appreciate helps! thanks a lot!
It really sounds like the interpreter is stumbling on the public keyword which it doesn't expect, which is an indication of/problem with the site running on PHP4.
Make sure you're echoing the PHP version in the site itself, not just looking it up in some control panel.
Check if there are any .htaccess directives that may change the default handler to PHP4.
Sometimes the host may default to PHP4 for .php files and PHP5 only for .php5 files.
I'm so sorry! I dont know how come, but Bluehost info panel says PHP 5 is active. and i just believed that. when I make a php_info(); page just in case, i saw actually it is php 4 :/
I updated server for PHP5 and now everything is fine.
I'm sorry for messing. and thanks all you for great support!!!
Are you having the same problem with the other functions in the class as well? because, as far as i know, you can't make a constructor public or private. It should be "function __construct()" only.
Take a look in your php.ini file for the php version that is running.
I deleted public part and it works fine. it is weird! is that public really important in there!?