Parse error when on production - symfony

I have developed a Symfony2 project (v2.2.2) and it was working all fine locally.
When I deploy it on my server I meet 2 issues:
the folder /bin does not transfer through Filezilla (impossible to start transfer)
i encounter a parse error when trying to access web/app.php/ in debug mode (see below)
First I do not understand why it would work in local but not on production.
I also guessed these errors where linked but I do not know what is /bin used for (contains only 2 files doctrine and doctrine.php) and if I remove it locally it keeps working ...
Parse error is the following :
"FatalErrorException: Parse: syntax error, unexpected '[' in /home/colocall/twinkler/src/Tk/ExpenseBundle/Services/Expenses.php line 21"
Expenses.php line 15->25:
public function getAllExpenses($member, $group)
{
$all_expenses_col = $group->getExpenses();
$all_expenses = array();
foreach($all_expenses_col as $expense){
$all_expenses[] = [$expense, $this->forYou($member, $expense)];
}
return $all_expenses;
}
Maybe linked to : The parse error also happen when i try to update my database through ssh connection.
If someone would know the reason why I can't make it working it would save my day that i have already lost ...
Thank you in advance,
Jules

Your error is produced by using the short array syntax [] in your code.
It is not available in PHP 5.3.10 aka on your production server. The short syntax was introduced in PHP 5.4 which explains why your code is working in your dev-environment.
change ...
$all_expenses[] = [$expense, $this->forYou($member, $expense)];
...to
$all_expenses[] = array($expense, $this->forYou($member, $expense));
... or update your server's php version and it will work :)

Related

problem deploying dotnet cloud function GCP

I have a .NET Core 3.1 cloud function (zipped source code on Cloud Storage Bucket), last time I successfully deployed it a month ago. Now I did a minor code change, zipped the source code and wanted to deploy a new version of it I get the following error:
Deployment failure: Build failed: Failed to run /bin/build: runtimeconfig.json does not exist; Error ID: 6b309792
It's really weird, I also tried to deploy the same source code that worked before and got the same error... What's the reason and how to fix it?
EDIT:
I forgot to mention that this function consists of a few projects in the following structure:
src
-my-function
-referenced_solution
--project1
--project2
--project3
To let GCP understand the structure I used GOOGLE_BUILDABLE="./my-function"
After some experimentation I changed var GOOGLE_BUILDABLE to just "my-function" and that fixed the problem. Still strange that it used to work fine with "./my-function"

Deno 500 error from dev.jspm.io installing dependencies

I'm trying to run my first deno script which is pretty much from the denoDB docs, it just tries to connect to a database with a SQLite3 connector (I'm on a Macbook pro so it should be installed):
import { Database, SQLite3Connector } from 'https://deno.land/x/denodb/mod.ts';
const connector = new SQLite3Connector({
filepath: './db.sqlite',
});
export const db = new Database(connector);
I'm running deno run api/db.ts and I get this error after a few successful downloads:
Download https://deno.land/std#0.149.0/encoding/hex.ts
Download https://deno.land/std#0.149.0/hash/_wasm/lib/deno_hash.generated.mjs
error: Import 'https://dev.jspm.io/inherits#2.0' failed: 500 Internal Server Error
at https://raw.githubusercontent.com/Zhomart/dex/930253915093e1e08d48ec0409b4aee800d8bd0c/lib-dyn/deps.ts:4:26
I've deleted my /Users/<me>/Library/Caches/deno/deps/https and reran the script a few times but I still can't get past this. In my browser trying to follow the URL https://dev.jspm.io/inherits#2.0 does give me an error. What is going on here? There's not much code and I imagine it's not broken for everybody. What do I need to do to get this script to run without issues?
EDIT: it seems to be a library error https://github.com/eveningkid/denodb/issues/348
This is an error caused by a nested depedency, from a project that is not maintained.
See this for more info: [https://jspm.org/jspm-dev-release]
The point is dev.jspm.io is now jspm.dev
A way to fix this is to fork and update depedencies.
Another thing, if you're not using deno deploy, you can just use this as a replacement for your denodb: https://raw.githubusercontent.com/joeldesante/denodb/master/mod.ts
Just note that this script is no more maintained either, but it will fix your problem
Edit
I just made a dirty quick fix for deno deploy use this as a depedency isntead of denodb: https://raw.githubusercontent.com/ninjinskii/denodb/master/mod.ts
Again, i may not maintain this script forever.
The best thing that can happen is an update from these libs maintainers

Error deployApp when uploading bundle for application - shinyapp

I'm trying for the first time to deploy an App on ShinyApp.io and I manage some issues do it.
I ran the command :
>shinyapps::deployApp('C:/Users/Karim/Documents/test')
And the following message appeared :
Preparing to deploy application...DONE
Uploading bundle for application: 66633...
Error in digest::digest(file.path(appDir, file), algo = "md5", file = TRUE) :
The file does not exist: C:\WINDOWS\TEMP\RtmpugxfSW\fileabc59e7164e/..
I noted that the file mentioned (C:\Windows\Temp...) does exist and contains ui and server files. Yet I don't know which file is missing.
I tried to see if there was no similar cases in the forum by I didn't find similar mistakes.
If anyone know how to solve this error or guide me.
Thank you in advance.
Karim.
Try using relative rather than absolute paths,
https://support.rstudio.com/hc/en-us/articles/229848967-Why-does-my-app-work-locally-but-not-on-shinyapps-io-

Wordpress error after upgrade "cannot redeclare" + "eval()'d"

Getting this error after a forced wordpress upload (I was working in the database when at one point of time I got an alert - while on the backend, with only one option to upgrade to the newer available version):
Fatal error: Cannot redeclare _421736532() (previously declared in /home/user/domains/mydomain.com/public_html/wp-content/themes/twentyelevenmodified/header.php(68) : eval()'d code:1) in /home/user/domains/mydomain.com/public_html/wp-content/themes/twentyelevenmodified/header.php(68) : eval()'d code on line 1
The above is when I try mydomain.com
When I try mydomain.com/wp-admin/, I am redirected to wp-login.php and getting the following error:
Fatal error: Cannot redeclare _421736532() (previously declared in /home/user/domains/mydomain.com/public_html/wp-login.php(80) : eval()'d code:1) in /home/user/domains/mydomain.com/public_html/wp-login.php(80) : eval()'d code on line 1
Pulling my hair out trying different things since 5 hours now. Any help will be appreciated.
EDIT: After testing, I found that the function.php file is correctly calling function twentyeleven_header_style() and the problem is coming just after calling this function. So it's the next function call that is causing the problem. If I could know what is the next function !!!
Wordpress doesn't use functions with those names. Deactivate your plugins or rename the plugins folder.
If that doesn't work then it's probably coming from your theme. Rename your theme folder so wordpress will revert to the default (assuming the default theme exists).
It sounds like you purchased a theme or plugin with obfuscated code and it's using eval() to run it and probably making a call home.
After much research, I found that the site in question was hacked. More than 100 files were corrupted with codes. I cleaned them all and now things are functioning.
For others facing the same problem, download the whole files to your computer and look for eval codes (can be easily recognized).

Error Loading Zend Gdata framework into Wordpress

I am trying to use the Zend Gdata framework with wordpress but I am having some issues.
Now everything works perfectly fine when I test on localhost with XAMPP. However on my web server my code breaks down.
Here is my code to include the framework.
`set_include_path(TEMPLATEPATH . '/includes/');
require_once ('Zend/Loader.php');
Zend_Loader::loadClass('Zend_Gdata_Youtube');`
That code produces the following error.
Warning: Zend_Loader::include_once(Zend/Gdata/Youtube.php) [zend-loader.include-once]: failed to open stream: No such file or directory in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php on line 146
Warning: Zend_Loader::include_once() [function.include]: Failed opening 'Zend/Gdata/Youtube.php' for inclusion (include_path='/home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/') in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php on line 146
Fatal error: Uncaught exception 'Zend_Exception' with message 'File "Zend/Gdata/Youtube.php" does not exist or class "Zend_Gdata_Youtube" was not found in the file' in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php:99 Stack trace: #0 /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/modules/yt_link_checker.php(19): Zend_Loader::loadClass('Zend_Gdata_Yout...') #1 /home/damain/public_html/mysite.com/wp-includes/plugin.php(405): load_zend_gdata('') #2 /home/damain/public_html/mysite.com/wp-admin/admin.php(111): do_action('load_zend_gdata', Array) #3 /home/damain/public_html/mysite.com/wp-admin/index.php(10): require_once('/home/damain/...') #4 {main} thrown in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php on line 99
I cannot seem to figure this issue out. Can anyone help?
The best solution in this case is to run the script requiring the Zend Loader and use var_dump(get_include_path()) to see what the server says the path is. Then keep modifying the php.ini include_path until the script finds it.
In your case, I'm not sure if 'damain' is supposed to be 'domain'. My include path which finally worked was:
/home2/thelove6/public_html/zf/ZendGdata/library" thelove6 being the username.
Did you look to see if those files exist in those directories? (/mysite/includes/Zend/Loader.php) and they have the correct permissions? It sounds like that could very well be the issue. The other thing to check with a simple phpinfo() would be that you have all of the libraries install on the live server.
Ok, the possible reason is: You're not using the proper case for the classname. For the version 1.11.11, it will be Zend_Gdata_YouTube rather than Zend_Gdata_Youtube.
Windows OS is ignoring the case, whereas the Linux server does not. Hope this will solve your problem, just look at the proper case of the Class or filenames.

Resources