Codeigniter - Setting up cron job, not working - php

I'm trying to follow the cron job setup as seen in the documentation but I keep running into an issue. In the command line it output all of the markup in the header.php with the following statements at the end:
<h1>An Error Was Encountered</h1>
<p>The MongoDB PECL extension has not been installed or enabled</p>
What I'm typing into the command line:
php index.php tools message
Is there something I need to install on the server? Here are my specs from pecl version.
PEAR Version: 1.9.4
PHP Version: 5.3.10-1ubuntu3.15
Zend Engine Version: 2.3.0
Running on: Linux lucrum 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:23 UTC 2013 x86_64

I don't have the rep to add this as a comment so i have to post as an answer. But judging from what you posted the error message is telling you that the MongoDB PECL extension hasn't been installed on your server. Have you checked to see if it actualy is installed? If it is then you need to look into your configuration.

Related

Problems building and using mssql.so php extension, AMPPS server on MAC OSX

I think what I need to know is how to specify the build architecture when building .php extensions on OSX.
What are the likely architectures that I should try first, and how to specify them?
The details:
I am having trouble building a working mssql.so php extension for my server.
I have been using an AMPPS server on mac to serve php based websites, accessing MySQL databases.
Now I need to connect to an MSSQL database. The AMPPS php installation does not include the mssql extension so when I try to use mssql_connect() I get the following error.
Call to undefined function `mssql_connect()` in /Applications/AMPPS/www/test.php
I think I need to add mssql.so to the php/lib/extensions/ext folder and then add
extension=mssql.so
to my php.ini file.
To build mssql.so I have found a couple of online tutorials that both use Freetds:
http://lkrms.org/php-with-freetds-on-os-x-mavericks/#comment-82521
http://blog.benjaminwalters.net/?p=10
I used home brew to install autoconf:
brew instal autoconf
Then I downloaded and installed freetds:
./configure --prefix=/usr/local/freetds --sysconfdir=/usr/local/freetds/conf/freetds --disable-libiconv --disable-odbc
make
sudo make install
Freetds was installed at /usr/local/freetds. Then I downloaded php. I have tried this with all the versions available for download 5.6.2, 5.5.18, 5.4.32 and 5.3.29. 5.3.29 had a problem and I could not generate mssql.so.
All of the other versions successfuly produced mssql.so using the following method:
Unzip package in downloads folder
cd php-5.4.17/ext/mssql
phpize
./configure --with-php-config=/usr/bin/php-config --with-mssql=/usr/local/freetds
make
Then I copy the generated mssql.so to /Applications/AMPPS/php-5.4/lib/extensions/ext and add this to the php.ini file.
extension=mssql.so
I restart the apache server and view the error / log file which has the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.4/lib/extensions/ext/mssql.so' - dlopen(/Applications/AMPPS/php-5.4/lib/extensions/ext/mssql.so, 9): no suitable image found. Did find:\n\t/Applications/AMPPS/php-5.4/lib/extensions/ext/mssql.so: mach-o, but wrong architecture in Unknown on line 0
So it seems like I have built mssql.so for the wrong architecture?
I looked at the terminal output when I configure the "make" for mssql.so and found the following indicating the architecture it is being made for:
checking build system type... i386-apple-darwin13.1.0
checking host system type... i386-apple-darwin13.1.0
checking target system type... i386-apple-darwin13.1.0
So it looks like I made it for i386. This is where I start to get confused.
After make the terminal instructs me to run "make test", I do this and receive the following output:
=====================================================================
PHP : /usr/bin/php PHP_SAPI : cli PHP_VERSION : 5.4.24
ZEND_VERSION: 2.4.0 PHP_OS : Darwin - Darwin myMac13.1.0 Darwin
Kernel Version 13.1.0:
Thu Jan 16 19:40:37 PST 2014;
root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
INI actual : /Users/user/downloads/php-5.6.2/ext/mssql/tmp-php.ini More .INIs :
CWD : /Users/user/Downloads/php-5.6.2/ext/mssql Extra dirs :
VALGRIND:Notused
===================================================================TIME START 2014-10-26 11:53:50
=====================================================================
No tests were run. It does not say why no tests were run which is frustrating. It mentions x86_64 which is not i386.
I tried to check what architecture my system is to verify if it should be i386 or x86_64.
I did this with uname and arch as follows:
uname -p
i368
uname -m
x86_64
arch
i386
So my machine hardware is x86_64 (uname -m) but the processor architecture is i386 (uname -p) I don't understand how these can be different or what the implications of this are.
So have I built mssql.so for the wrong architecture or have I done something else wrong? If I have built it for the wrong architecture then how do I configure it to build for the correct one?
Many thanks for any help with this.

How to configure PHP builid

I'm attempting to add the gettext() extension to the PHP build, the installation instructions are not very clear:
To include GNU gettext support in your PHP build you
must add the option --with-gettext[=DIR] where DIR is the
gettext install directory, defaults to /usr/local.
Where do i place this option, and in which file? (I have never configured PHP before)
Is Apache restart required? If so, how long does it take and what are the dangers?
I have not installed gettext myself, it looks to be preinstalled on my system:
# rpm -qi gettext
Name : gettext Relocations: (not relocatable)
Version : 0.17 Vendor: CentOS
Release : 16.el6 Build Date: Thu 11 Nov 2010 04:06:25 AM EST
Install Date: Tue 30 Jul 2013 03:03:04 PM EDT
The gettext extension is installed by default, but not its PHP bindings. Install package php-gettext to add those to your system. The package manager will handle all other bindings for you, and probably even restart Apache for you. On a normal system in a normal situation that takes less than a second, and your users won't notice anything since Apache gracefully waits for existing requests to finish when shutting down.
Ignore the install notes in the PHP manual when not running a self-compiled version of PHP - on systems like Debian, Ubuntu, CentOS etc. the package manager will handle most common tasks like this for you in a safer way.
The comment in the instructions is directed towards compiling from source.
Like Niels wrote, package manager should do the job and take care of all missing dependencies. Since your system is CentOS try this:
yum install php-gettext
I come to this question with the php-build tool. In case to compile with php-build tool and would like to add the custom configuration, you can configure it in /usr/local/share/php-build. (Ubuntu), it may in another directory up to your platform.
Go there and edit file default_configure_options and put any custom configurations as you wishes.
ex.
--with-gettext=/usr/bin

apache eaccelerator build php version

I'm trying to get eAccelerator 0.9.6.1 installed to speed up my Magento site.
Pretty vanilla install per the directions here:
http://docs.moodle.org/24/en/Installing_eAccelerator_In_Ubuntu_Server
Unfortunately, php -v does not show eAccelerator, and apache error log shows on restart after install:
[eAccelerator] This build of "eAccelerator" was compiled for PHP version 5.3.10-1ubuntu3.7. Rebuild it for your PHP version (5.3.10-1ubuntu3.8) or download precompiled binaries.
/usr/bin/php-config shows
version="5.3.10-1ubuntu3.8"
make test says
PHP : /usr/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.3.10-1ubuntu3.8
ZEND_VERSION: 2.3.0
PHP_OS : Linux - Linux libatio 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:04:05 UTC 2012 i686
phpinfo shows eAccelerator section with nothing enabled.
eAccelerator control.php shows no data.
What am I missing here? Seems I am compiling for the correct php, but apache disagrees?
Thanks,
C
No secret here except repeated reinstall with another copy of the same distro, although in the meantime I also installed Zend Optimizer and IonCube php loader.
Cheers ,
C

How to install amqp on windows

I am having this error while installing pecl/amqp
when I type in the command line: pear install pecl/amqp
WARNING: php_bin C:\xampp\php.\php.exe appears to have a suffix .\php.exe,
but
config variable php_suffix does not match
ERROR: The DSP amqp.dsp does not exist.
I need to install this so that I can use amqp (RabbitMQ) on php.
# AMQP installation php.net:
Note to Windows users: This extension does not currently support Windows since the librabbitmq library does not yet support Windows.
But here at RabbitMQ website is a windows installer...
Apparently the information on the php.net page is outdated
To install do like this:
Download the correct package for your php from this official PECL amqp page
unzip
add php_amqp.dll to your php ext folder and enable the extension inside your php.ini file: extension=php_amqp.dll
add rabbitmq.#.dll to your windows system 32 folder (where # corresponds with the version number).
All this according to the post on the blog I found here.
UPDATE
I updated some of the information above. The blog post is from 2013, and only mentioning older versions, but it is anyway a nice guide to the steps you need to take. Since then newer versions are available so be aware there are some slight differences in the process (mainly version numbers) if you want to install a newer version.
This works for me in PHP 7.1, and amqp 1.9.4 for Windows.
Download the correct package in https://pecl.php.net/package/amqp based on your PHP version, architecture, thread safety, and compiler. You can check it in phpinfo
Copy php_amqp.dll to your php ext folder
Update your php.ini with: extension=php_amqp.dll
Copy rabbitmq.4.dll to your windows system 32 folder if 32bit system. add it to SysWOW64 if using 64bit system.
Restart apache.
On Windows 10, build 19041 (2004 update), 64-bit.
Using Xampp with PHP 7.4.8.
Go to here and download your relevant version: https://pecl.php.net/package/amqp (check which version you need in CLI using php -v)
From the .zip, copy the rabbitmq.#.dll to C:/Windows/System32
From the .zip, copy the php_amqp.dll to C:/xampp/php/ext (or simply your php/ext folder if using something else than Xampp)
If you've got PHP running as a service with Apache, restart Apache. If you're using it via CLI (e.g. via Bash and/or Symfony CLI server) then you're already good to go.
Other posts mention the 64-bit variant to have the rabbitmq.#.dll (where # is the version) to go in C:/Windows/SysWOW64. I tried that, didn't work for me, even though running 64-bit Windows and PHP.
$ php -v
PHP 7.4.8 (cli) (built: Jul 9 2020 11:30:39) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Although this will not answer how to install RabbitMQ with the pear install pecl/amqp, but have you ever tried to use rabbitmq with the pure php implementation php-amqplib?
After many hours of search: To install amqp to php7.4 & Windows 10 (https://pecl.php.net/package/amqp),
Choose the good file (x86,x64,ts,nts)
php -i or phpinfo() (Architecture => x64)
php -i|findstr "Thread" (ts or nts enable)
Copy rabbitmq.4.dll and rabbitmq.4.pdb files to PHP root folder php_amqp.dll and php_amqp.pdb files to PHP\ext folder
Add extension=amqp to the php.ini file
check php -m if you show amqp (php -v to show errors)
Big thank's to Rezende (tutorial)
If you are on Windows, on this Url you can download the installable rabbitmq and here is the direct download link for RabbitMQ 3.9.11.
You can also use choco to install it using:
choco install rabbitmq
And since, rabbitmq is implemented/written in erlang you also need erlang to be able to install rabbitmq and its services. Make sure you download erlang and install it.

PHC Configure fails. Can't find boost library but it's installed

For some reason when I attempt to configure phc-0.2.0.3 oh my machine (Fedora Linux localhost.localdomain 2.6.34.6-47.fc13.i686 #1 SMP Fri Aug 27 09:48:44 UTC 2010 i686 i686 i386 GNU/Linux) I get the following error:
checking for boostlib >= 1.34.0... configure: error: We could not detect the boost libraries (version 1.34 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.
Boost is installed to /usr/include/boost. I tried setting the environment variable as specified in the error to $BOOST_ROOT=/usr/include/boost and when that didn't work i tried $BOOST_ROOT=/usr/include. Once I did that I tried
./configure --with-boost
and
./configure
Both times I got the same error. Here is the site for phc:
http://www.phpcompiler.org/
The boost site is here:
http://www.randspringer.de/boost/ucl.html
Has anyone had this issue before?
I recompiled PHP and installed it. That resolved the issue.

Categories