Fatal error: can't use function return value in write context in /var/www/html/chamilo/main/inc/lib/api.lib.php on line 1772 - chamilo-lms

I am getting the following error while installing chamilo version 1.11.6.
Fatal error: can't use function return value in write context in /var/www/html/chamilo/main/inc/lib/api.lib.php on line 1772
My php version is 7.2.

This error appears because somehow the PHP version is not 7.2 (but rather <5.5) in the context in which you are executing the page.
Since PHP 5.5, the emty() function was changed to support function results.
See http://php.net/manual/en/function.empty.php
Note:
Prior to PHP 5.5, empty() only supports variables; anything else
will result in a parse error. In other words, the following will
not work: empty(trim($name)). Instead, use trim($name) == false.
My guess is the place where you change the PHP version in your control panel doesn't affect (or didn't affect yet) the place where Chamilo is being loaded.
Ask your hosting provider, maybe?
You can place a "info.php" file with the following content at the root of Chamilo and load it directly through the browser. This will tell you what version PHP is running at in the Chamilo directory:
<?php
phpinfo();
I bet it still shows PHP 5.4...

Related

Can't connect to MariaDB via MATLAB - Invalid MEX File

I am trying to connect to MariaDB using mYm (Mysql wrapper for MATLAB) on MATLAB.
Every time I use mYm to access DB I get an error
Invalid MEX-file 'path\to\DB\MySQL\mYm1.36 64-bit\mym.mexw64': A dynamic link library (DLL) initialization routine failed.
So far what I've understood is that DLL in question i.e. libmysql.dll is not registered.I tried do do that using regsvr32 "path\to\DB\MySQL\mYm1.36 64-bit\libmysql.dll". But that results in following error:
The module path\to\DB\MySQL\mYm1.36 64-bit\libmysql.dll failed to load.
Make sure the binary is stored at specified path or debug it to check for problems with binary or dependent .DLL files.
The specified module could not be found.
I require a solution to fix this error.
I might be wrong in assuming the dll is not registered.

Fatal error: Uncaught Error: Call to undefined function mysql_connect()

I am not sure why this isn't working. Here is the code it is referencing.
function db_connection($query) {
mysql_connect('127.0.0.1', 'runner_db_user', 'runner_db_password')
OR die(fail('Could not connect to database.'));
mysql_select_db('ntc_race_info');
return mysql_query($query);
Make sure your installation of PHP has been compiled with mysql support. Run a phpinfo() to see if the php_mysql extension module is loaded. Create a test web page containing
<?php
phpinfo();
?>
then run it,If you don't see page for MySQL, you need to recompile PHP with MySQL support, or reinstall a PHP package that has it built-in
or use mysqli_connect() instead of mysql_connect()
$con = mysqli_connect("127.0.0.1","runner_db_user","runner_db_password","ntc_race_info");

Failed to build libmysql on windows using vc2008

I want to build libmysql.dll, so I got source code mysql-connector-c-6.1.6-src.zip from http://dev.mysql.com/downloads/connector/c/.
Then cmake-gui.exe to configure and generate vc 2008 sln, leave all settings default.
Then got errors and warnings when building, like this:
mysql-connector-c-6.1.6-src\include\thr_cond.h(109) : error C2065: “ETIMEDOUT”: 未声明的标识符(an unspecified identifier)
mysql-connector-c-6.1.6-src\include\thr_rwlock.h(80) : warning C4013: “TryAcquireSRWLockShared” 未定义(not defined)
mysql-connector-c-6.1.6-src\include\thr_rwlock.h(102) : warning C4013: “TryAcquireSRWLockExclusive” 未定义(not defined)
I searched the source, and find ETIMEDOUT is defined in my_pthread.h, so I include this header in thr_cond.h, but still error.
And TryAcquireSRWLockShared and TryAcquireSRWLockExclusive seem only supported on Win7 and later !
Do I have done something wrong?
How can I build libmysql?
Any help will be appreciated.
Download the previous version (6.0.2), it doesn's use the TryAcquireSRWLockShared() API function.
With a few minor tweeks, it compiles clean with MSVC 2008.
Here are the modifications (based on the extracted zip file root):
Replace line 306 of include/config-win.h with:
// avoid annoying warning
#ifndef HAVE_COMPRESS
# define HAVE_COMPRESS
#endif
Comment lines 350-367 of CMakeLists.txt (CPack instructions cause CMake to fail)
Follow instructions in BUILD.win

Php and Smarty3 - filemtime() [function.filemtime]: stat failed for

I'm migrating my WebAPP from Smarty2 to Smarty3. Every step is easy except one. When i display a Smarty Template ( tpl ) an Exception is thrown.
This line
Source: /path_to_file/smarty/libs/sysplugins/smarty_resource.php (773)
(this is the source coude $compiled->timestamp = #filemtime($compiled->filepath); )
raise this Exception when the file doesn't exists
filemtime() [function.filemtime]: stat failed for /path_to_templates/smarty/templates_c/219dfe732aae7bd7c0edab091e3c53f3ce86b058.file.index.tpl.php
Folder permissions:
Smarty template folder Permission : 775
Smarty Cache folder permission: 775
Folder Owners:
both ftp_user:webserver_user
I'm trying to implement different solutions but it seems not possibile to solve this issue whitout changhing Php Error Reporting or disabling my Error Handler .
How can i solve this problem without hacks ?
What you should do is not to downgrade to 3.1.1 but rather try to upgrade to 3.1.19 version. Many bugs are removed all the time so maybe in this version you won't have it.
The other thing is that you can use muteExpectedErrors method to hide file system warnings from Smarty (documentation for this function is not very clear but it affects file system warnings what is explained in error_reporting documentation). You can read at error_reporting documentation page:
Smarty 3.1.2 introduced the muteExpectedErrors() function. Calling
Smarty::muteExpectedErrors(); after setting up custom error handling
will ensure that warnings and notices (deliberately) produced by
Smarty will not be passed to other custom error handlers. If your
error logs are filling up with warnings regarding filemtime() or
unlink() calls, please enable Smarty's error muting.
Check the filesystem permission on /path_to_templates/smarty/templates_c/219dfe732aae7bd7c0edab091e3c53f3ce86b058.file.index.tpl.php
PHP does not seam to have read/write permission on that file.
Also check the permission in the /path_to_templates/smarty/templates_c/ folder. Is the PHP allowed to read list and write in there as well?

xcode: Mysql connector library not work on iphone5 (armv7s) ,any solution?

I built my App using Mysql Connector/C to connect a remote Mysql database, its works fine on the simulator (no errors, no warnings) but when i try to run it on my device (iphone5) i got this error:
No architectures to compile for (ARCHS=armv7 armv7s, VALID_ARCHS=armv7 armv7s)
i tried -as in some answers- to change setting (Architectures - Build Active Architectures- Valid Architectures) but the error still, only when i change the setting (Architectures & Valid Architectures) to "armv6" its build without error but many warnings appears says:
warning: no rule to process file '(my App dir)/main.m' of type sourcecode.c.objc for architecture armv6
and also for all .m files, when i tried to start the App i got message:
Xcode cannot run using selected device
I know that the Connector library need to update , but are there any solution ?
your need compile the connector lib in xcode for iOS (armv6, armv7, armv7s, i386), then use lipo tool to combine output libs.
direct connect your mysql in app is not safe, a suggest way is setup a Apache+PHP+MySQL server, then on iPhone useing ASIHTTPRequest to connect your server.