When trying to upgrade XAMPP pear the following error is raised:
Fatal error: Cannot use result of built-in function in write context in C:\xampp\php\pear\Archive\Tar.php on line 639
Some suggestions how to fix this?
Just change in Tar.php
$v_att_list = & func_get_args();
to
$v_att_list = func_get_args();
PD:Tested over PHP 7.2 in Xammp
Usually this means you have a function inside a fuction, and sometimes it doesn't like that.
As an example, if this caused the error:
if(!isset(Session::get($something))){
Then you could change it to this to fix the problem:
$value = Session::get($something);
if(!isset($value)){
Related
I'm testing out php 7 and have come across this error:
Fatal error: Uncaught Error: Call to undefined function odbc_connect()
From the doc page: http://php.net/manual/en/function.odbc-connect.php php 7 is not listed as supported.
Does anyone have a way around this or know when it will be supported?
Thanks#
There is written in doc: ODBC support doesn't need any extension dll. It is true in PHP 5.x, I had to remove "extension=php_odbc.dll" from ini file.
But in PHP 7 I had to put it back.
I found the file "ext/php_odbc.dll" in the new PHP 7 directory again. It works for me :).
The DOC page does list PHP 7, so just install php-odbc and you should be good to go. Currently using it myself on RedHat EL7 with Remi php7.
I ran into the same problem. However according to the link you provided PHP7 is in fact supported. So I'm not sure why you have so many comments telling you to go re-write your code.
This is what ultimately fixed the issue for me:
sudo apt-get install php-odbc
Followed by restarting Apache.
PHP 7.2.7, add extension=php_odbc.dll in php.ini file while either using database as MS Access or Sql Server
C:\xxxxxx\php\php.ini
*no semicolon before to extension=php_odbc.dll
Just enble "php_odbc.dll" extension by removing the semicolon and restart Apache.
If there is no such line in php.ini, simply create it on yourself (you will find many similar lines in php.ini) by adding: extension=php_odbc.dll and then restart Apache.
If Apache does not start or cannot load php_odbc.dll, look into to the ext-Folder of PHP, if there is such a DLL called php_odbc.dll. If there is no such DLL, Xampp/PHP7 does not support ODBC natively. In that case you should install an older Xampp Version with PHP 5.x
From php.ini file:
> ; Notes for Windows environments :
> ;
> ; - ODBC support is built in, so no dll is needed for it.
> ; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
But, in PHP 7, ODBC is not by default. Explicit
extension=odbc
worked for me (new syntax recommended)
Edit:
If your architecture is x64
you must use C:\Windows\SysWOW64\odbcad32.exe
instead of C:\Windows\system32\odbcad32.exe
Here is the error message:
Redhat PHP Fatal error: Uncaught Error: Call to undefined function
odbc_connect()
On Redhat Linux 7 you run:
yum install php-odbc
You will get these packages marked in red:
Code sample to test your connection via php command line run: php [filename].php
<?php
// filename: test-connection.php by running command -> php test-connection.php
$connect = odbc_connect("Driver=FreeTDS; Server=sbase.company.ca; Port=1433; TDS_Version=8; ClientCharset=UTF-8; Database=mydbase",'company\\user', 'password');
$query = "SELECT * from mytable";
// perform the query
$result = odbc_exec($connect, $query);
// fetch the data from the database
while(odbc_fetch_row($result)){
$suid = odbc_result($result, 1);
$uid = odbc_result($result, 2);
$gid = odbc_result($result, 3);
$name = odbc_result($result, 4);
print("$name|$suid|$uid|$gid\n");
}
// close the connection
odbc_close($connect);
?>
Enjoy!
I am trying to use semaphores on php but cannot get sem_get() function to work. Here is my PHP code:
<?php
$key = 123567;
$maxAcquire = 1;
$permissions = 0666;
$autoRelease = 1;
//it gives the error on the line below
$semaphore = sem_get($key, $maxAcquire, $permissions, $autoRelease);
sem_acquire($semaphore);
echo "hello world!";
sem_release($semaphore);
?>
When I try to run it with:
php semaphore.php
It prints this error:
PHP Fatal error: Uncaught Error: Call to undefined function sem_get()
in /root/semaphore.php:8
Stack trace:
#0 {main}
thrown in /root/semaphore.php on line 8
I am working on Arch Linux with PHP 7.0.3 (cli). I guess the solution is so simple but I couldn't find a way to fix it. If you could help me, I would appreciate it. Thanks.
Support for semaphores is not a standard feature of php.
It has to be activated via compiler --enable-sysvsem option when creating the php binary.
See explanation in manual: http://php.net/manual/en/sem.installation.php
Thank you all! I uncommented the line :
extension=sysvsem.so
on php.ini and it worked!
The semaphore extension is not available by default, as stated in the docs:
Support for this functions are not enabled by default. To enable System V semaphore support compile PHP with the option --enable-sysvsem . To enable the System V shared memory support compile PHP with the option --enable-sysvshm . To enable the System V messages support compile PHP with the option --enable-sysvmsg .
If you are on a hosted server, then that hosting service probably does not offer this.
Have a look at the docs. It feels like you do not have installed php with semaphores properly. Have a look at the installation instructions.
I'm testing out php 7 and have come across this error:
Fatal error: Uncaught Error: Call to undefined function odbc_connect()
From the doc page: http://php.net/manual/en/function.odbc-connect.php php 7 is not listed as supported.
Does anyone have a way around this or know when it will be supported?
Thanks#
There is written in doc: ODBC support doesn't need any extension dll. It is true in PHP 5.x, I had to remove "extension=php_odbc.dll" from ini file.
But in PHP 7 I had to put it back.
I found the file "ext/php_odbc.dll" in the new PHP 7 directory again. It works for me :).
The DOC page does list PHP 7, so just install php-odbc and you should be good to go. Currently using it myself on RedHat EL7 with Remi php7.
I ran into the same problem. However according to the link you provided PHP7 is in fact supported. So I'm not sure why you have so many comments telling you to go re-write your code.
This is what ultimately fixed the issue for me:
sudo apt-get install php-odbc
Followed by restarting Apache.
PHP 7.2.7, add extension=php_odbc.dll in php.ini file while either using database as MS Access or Sql Server
C:\xxxxxx\php\php.ini
*no semicolon before to extension=php_odbc.dll
Just enble "php_odbc.dll" extension by removing the semicolon and restart Apache.
If there is no such line in php.ini, simply create it on yourself (you will find many similar lines in php.ini) by adding: extension=php_odbc.dll and then restart Apache.
If Apache does not start or cannot load php_odbc.dll, look into to the ext-Folder of PHP, if there is such a DLL called php_odbc.dll. If there is no such DLL, Xampp/PHP7 does not support ODBC natively. In that case you should install an older Xampp Version with PHP 5.x
From php.ini file:
> ; Notes for Windows environments :
> ;
> ; - ODBC support is built in, so no dll is needed for it.
> ; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
But, in PHP 7, ODBC is not by default. Explicit
extension=odbc
worked for me (new syntax recommended)
Edit:
If your architecture is x64
you must use C:\Windows\SysWOW64\odbcad32.exe
instead of C:\Windows\system32\odbcad32.exe
Here is the error message:
Redhat PHP Fatal error: Uncaught Error: Call to undefined function
odbc_connect()
On Redhat Linux 7 you run:
yum install php-odbc
You will get these packages marked in red:
Code sample to test your connection via php command line run: php [filename].php
<?php
// filename: test-connection.php by running command -> php test-connection.php
$connect = odbc_connect("Driver=FreeTDS; Server=sbase.company.ca; Port=1433; TDS_Version=8; ClientCharset=UTF-8; Database=mydbase",'company\\user', 'password');
$query = "SELECT * from mytable";
// perform the query
$result = odbc_exec($connect, $query);
// fetch the data from the database
while(odbc_fetch_row($result)){
$suid = odbc_result($result, 1);
$uid = odbc_result($result, 2);
$gid = odbc_result($result, 3);
$name = odbc_result($result, 4);
print("$name|$suid|$uid|$gid\n");
}
// close the connection
odbc_close($connect);
?>
Enjoy!
I am trying to install magento (e-commerce platform)
I am following a tutorial that tells me to run this command using ssh: ./pear mage-setup
but I'm getting this error:
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/domainname.com/downloader/pearlib/php/System.php on line 400
Line 400 is commented in the code snippit from the system.php file:
/* Magento fix for set tmp dir in config.ini
*/
if (class_exists('Maged_Controller',false)) {
/*line 400 */
$magedConfig = Maged_Controller::model('Config',true)->load();**
if ($magedConfig->get('use_custom_permissions_mode') == '1' &&
$mode = $magedConfig->get('mkdir_mode')) {
$result = System::mkDir(array('-m' . $mode, $tmpdir));
} else {
$result = System::mkDir(array('-p', $tmpdir));
}
if (!$result) {
return false;
}
}
Can anyone help me demystify this error?
I'm wondering what the double-stars are on the fifth line:
# here - v
$magedConfig = Maged_Controller::model('Config',true)->load();**
Edit: You are attempting to use "chaining" ($obj->func()->otherFunc()) which is only supported in PHP5:
$magedConfig = Maged_Controller::model('Config',true)->load();
Change the line to this:
$magedConfig = Maged_Controller::model('Config',true);
$magedConfig = $magedConfig->load();
Your other option is to upgrade to PHP 5, but at this point in the game, it might break your code.
Verify that you meet the following requirements:
http://www.magentocommerce.com/system-requirements
Magento only runs on php 5.2.x, not 5.3.
Also make sure the extensions listed on the requirements page are enabled.
Might be different for you, but I can check the php version using
php -v
Try ./mage mage-setup instead of ./pear mage-setup.
The following instruction solved this issue for me:-
Solution:
In the directory that your magento installation is in
nano pear
after the first two lines paste
MAGE_PEAR_PHP_BIN=/usr/local/bin/php5;
export MAGE_PEAR_PHP_BIN
ctrl + o -> to save
ctrl + x -> to exit
The above solution is about editing file named 'pear' present in your Magento root folder through terminal. If you have FTP access then you can simply edit the file 'pear' by adding the following lines at the beginning:-
MAGE_PEAR_PHP_BIN=/usr/local/bin/php5;
export MAGE_PEAR_PHP_BIN
Source: http://www.magentocommerce.com/boards/viewreply/222042/
I have a problem with PECL::Runkit with this little example
index.php contain <?php
runkit_import('a.php');
runkit_import('b.php');
Doublon::get();
a.php et b.php each contain the same code
class Doublon
{
static function get() { echo "class " . __FILE__; }
}
On my PC (Windows XP, Wampserver 2, php 5.2.9-2, runkit DLL bundled with
Wamp) it work and index.php show
class C:\wamp2\www\utilitaires\essais\runkit\b.php
On my Linux CentOS 5 server, PHP 5.2.10, Runkit compiled by hand
Warning: runkit_import() [function.runkit-import]: class doublon not
found in /shares/public/cedric/test/index.php on line 2
Warning: runkit_import() [function.runkit-import]: Cannot redeclare
class doublon in /shares/public/cedric/test/index.php on line 2
Warning: runkit_import() [function.runkit-import]: class doublon not
found in /shares/public/cedric/test/index.php on line 3
Warning: runkit_import() [function.runkit-import]: Cannot redeclare
class doublon in /shares/public/cedric/test/index.php on line 3
Fatal error: Class 'Doublon' not found in
/shares/public/cedric/test/index.php on line 4
One problem : runkit's make test give me 100% of tests failed, but I still don't know why.
The runkit version from the linux distribution just make crash Apache :
PHP Startup: Timezone database is corrupt
I dropped xdebug, return to php 5.2.9, but the errors are the same
Thanks in advance, Cédric
The Package site says:
WARNING: 0.9 does not compile with PHP 5.2+ so use the CVS version instead.
Are you using the CVS version?
The up-to-date runkit extension can be found on http://github.com/zenovich/runkit
Anyway, as I know, runkit never had a feature to define new class on importing. It only can add or change members of existing classes. If you really want this, you can open the feature-request on http://github.com/zenovich/runkit
To determine why you get different results on your platforms, I need to know the versions of runkit and PHP for both of them. You can get all the information using the command 'php -i'.