How to install IonCube Loader on Amazon Linux x64 instance - php

I'm having trouble installing IonCube Loader on my Amazon Linux x64 instance.
I'm following these instructions below but the paths are way off and I can't seem to locate the right ones on my install.
For x64:
wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfvz ioncube_loaders_lin_x86-64.tar.gz
Proceed as follows:
cp ioncube/ioncube_loader_lin_5.3.so /usr/lib/php5/20090626/ioncube.so
Now edit to match:
zend_extension = /usr/lib/php5/20090626/ioncube.so
nano /etc/php5/conf.d/ioncube.ini
First, there is no /usr/lib/php5/20090626/ folder. I changed these paths to /usr/lib64/php/modules and included the .so file in there.
However, I cannot seem to locate any ioncube.ini file to edit. Any help is appreciated...
Thank you!

For future readers sake, there is a difference between Amazon's Linux and other versions that most articles online refer to.
You can follow the first two steps above to get the installer, I like to use a temporary folder. Do this as root:
sudo -i
cd /tmp
wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfvz ioncube_loaders_lin_x86-64.tar.gz
Copy the required extension to a slightly different folder under EC2 linux instances, and the loader wizard to your webroot:
cp ioncube/ioncube_loader_lin_5.4.so /usr/lib64/php/modules/ioncube.so
Create your ini file:
echo "zend_extension=/usr/lib64/php/modules/ioncube.so" > /etc/php.d/ioncube.ini
Reload Apache (if you're using it):
service httpd restart
I'm using NGINX and PHP-FPM, in this case you'd probably want to restart PHP-FPM as well as NGINX.
Lastly, use the loader wizard to test it by navigating to http://example.com/loader-wizard.php, and delete the temp files and loader wizard when finished:
rm -rf /tmp/ioncube*
rm /var/www/html/loader-wizard.php

I followed the instructions provided here in the first answer, making allowance for the fact that I'm runnning PHP 5.6:
sudo cp ioncube_loader_lin_5.6.so /usr/lib64/php/5.6/modules/ioncube.so
echo "zend_extension=/usr/lib64/php/5.6/modules/ioncube.so" > /etc/php.d/ioncube.ini
However, when restarting Apache, I found that it started then failed immediately. The Apache log gave me this error:
PHP Fatal error: [ionCube Loader] The Loader must appear as the first entry in the php.ini file in Unknown on line 0
I changed the name of the file from ioncube.so to 00-ioncube.so and restarted Apache. This solved the problem by making this file load before the other modules.

Related

How can we scan infected user uploaded files before moving to the right folder [Ubuntu+Apache+PHP+Laravel]

How can we scan the files uploaded by the user from the application?
In our case when the user uploads the file from the application it goes to the /tmp directory and from the /tmp directory it goes to the S3 bucket.
Server: Ubuntu + PHP5.6 + Laravel
How to restrict the infected file in the very first step when the user uploads the file and it goes to the /tmp?
Though I have tried to implement ClamAV security but it's not working on the ubuntu with PHP5.6 version.
Please download the latest php-clamav tarball from Launchpad.
Install php5-dev, clamav if you haven't already with sudo apt-get
Extract the tarball, cd into the php-clamav-xxxx directory, and
follow these steps to install the php-clamav module (adapted from
INSTALL):
phpize
./configure --with-clamav
make
cp modules/clamav.so /usr/local/lib/php/extensions/
(restart Apache)
service httpd restart
Answer found in askubuntu

php include path doesnt work

My server uses Ubuntu with PHP5 and NginX.
I have installed pear using sudo apt-get install php-pear, and later uninstalled it using sudo pear uninstall pear. Today I downloaded phpmailer using sudo apt-get install libphp-phpmailer.
I wrote code to send email with phpmailer. It begins with:
require_once("class.phpmailer.php");
and I edit the php.ini both in /etc/php5/cli and in /etc/php5/fpm to set:
include_path = ".:/usr/share/php/libphp-phpmailer"
It did work well if I execute this php program in command line, but if I visit this php page through my browser, it produce a HTML500 error, and I checked the error.log file, which shows:
PHP message: PHP Fatal error: require_once():
Failed opening required 'class.phpmailer.php'
(include_path='.:/usr/share/php:/usr/share/pear') in ...
I wander how comes this path? I am sure I have edited the include_path in both php.ini files. Is there another configuration file I missed? Where does the string ".:/usr/share/php:/usr/share/pear" come from?
If you are absolutely sure all paths are correct then it could be a file permission issue.
Find out what user Nginx runs under. It will probably be nginx. Run groups nginx and the output should be nginx : nginx, meaning the user nginx exists, and has only one group, which is also nginx.
On the command line navigate to the location of class.phpmailer.php and run ls -l to view the permissions of the files in that directory. Example output would be: -rw-r--r-- 1 someuser somegroup, meaning read and write access is granted to the owner (someuser), read access for the group (somegroup), and read access to everybody else.
The user nginx (if that is what it is running under) needs to have read access to that file. So change the owner/permissions as necessary.
If you need further explanation of how to do any of this just give me a shout and I will update this with further instructions.

How to install PHP SSH2 extension in a non-standard folder on linux without root access

I am way out of my area of expertise and have scoured the internet and stackoverflow for a solution to this problem with none to be found. I am trying to install the PHP SSH2 extension in my account's folder on a linux (don't know which flavor) shared hosting server where I don't have root access.
I was able to successfully create libssh2-1.4.3 in a private folder with the following commands:
./configure --prefix=/home/myaccnt/php/ssh2/install
make
make install
and end up with the following files in the /home/myaccnt/php/ssh2/install/lib folder:
libssh2.a
libssh2.la
libssh2.so
libssh2.so.1
libssh2.so.1.0.1
So far, so good (at least I think so good).
Next, I tried to build ssh2-0.11.3 but I can't get past the configure step. I have tried several different ways to run the configure command:
./configure --prefix=/home/myaccnt/php/ssh2/install --with-ssh2=/home/myaccnt/php/ssh2/install
./configure --prefix=/home/myaccnt/php/ssh2/install --with-ssh2=/home/myaccnt/php/ssh2/install/lib
but the configure script always can't find libssh2 and I get the following messages:
checking for ssh2 support... yes, shared
checking for ssh2 files in default path... not found
configure: error: The required libssh2 library was not found. You can obtain that package from http://sourceforge.net/projects/libssh2/
So, the question is, how do I get the PHP SSH2 extension configure script to find libssh2?
Thanks in advance for you help. It really is appreciated.
After a few hours poking through the configure script and even more hours searching the internet, I figured out a way to accomplish this. For those that might be interested in doing something similar, here's what I did.
I started with instructions at www.php.net/manual/en/ssh2.installation.php and did the following:
Create libssh2:
Created a folder under my home directory called "php" and then a folder within it called "ext" and another folder called "ssh2".
cd /<myhome>/php/ssh2
download the libssh2 package from libssh2.org into the php/ssh2 folder
tar vxzf libssh2-1.4.3.tar.gz
cd libssh2-1.4.3
./configure --prefix=$HOME
make
make install
Create ssh2:
cd /<myhome>/php/ssh2
download the php-ssh2 package from pecl.php.net/package/ssh2
tar vxzf ssh2-0.11.3
cd ssh2-0.11.3
phpize
./configure --prefix=$HOME --with-ssh2=$HOME
make
Copied /<myhome>/ssh2-0.11.3/modules/ssh2.so to /<myhome>/php/ext/ssh2.so
Modified my php.ini to include extension=/<myhome>/php/ext/ssh2.so
And now I have ssh2 available to my scripts on a shared server. Hope someone find this helpful.

Installing pecl,pear and xde on mamp

I am trying to install pecl,pearl and xdebug on mamp 2.1.2. I have tried almost everything but even when xdebug appear in phpinfo it doesn't seem to work. I tried it for netbeans too but nothing. I am a new to mac and really frustrated on how to run it and make a local project of mine debug using breakpoints. can someone help me figure it out on how to make pecl,pear and xdebug on my OSX so i can debug my project.
Check this link :
http://www.lullabot.com/articles/installing-php-pear-and-pecl-extensions-on-mamp-mac-os-x-107-lion
Edit
MAMP doesn’t ship with a bunch of the PHP sources
Download MAMP components and configure
URL: http://www.mamp.info/en/downloads/index.html (i.e. MAMP_components_2.0.2.zip)
Unpack your MAMP_components_2.0.2.zip
Identify your php-5.x.x.tar.gz file (where 5.x.x is your version of PHP)
Create directory for your PHP sources: "mkdir -vp /Applications/MAMP/bin/php5/include"
Untar php-5.x.x.tar.gz into /Applications/MAMP/bin/php/php5.*/include or /Applications/MAMP/bin/php5/ include e.g. tar zxvf php-5.x.x.tar.gz -C /Applications/MAMP/bin/php/php5.?.??/include
Rename your php-5.x.x directory to php (without the version numbering) e.g. mv /Applications/MAMP/bin/php/php5.2.17/include/php-5.?.?? /Applications/ MAMP/bin/php/php5.2.17/include/php
Configure PHP sources (it’ll create necessary files i.e. zend_config.h, tsrm_config.h, etc.)
cd /Applications/MAMP/bin/php/php5.?.??/include/php ./configure
The process was for another fix but this resolved the issues with php.h not being found

Wamp 2.2 install PEAR

My operating system is Windows 7.
I got my WAMP2.2 install in my computer.
Then I try to install PEAR.
However, I can not find my go-pear.bat file in my wamp directory.
Fine. I download in here: http://pear.php.net/go-pear.phar
and install using this file.
I put the file in
C:/wamp/bin/php/php5.3.8/pear/go-pear.phar
Run the command: php -d phar.require_hash=0 PEAR/go-pear.phar
After the installation, I include the path of pear in php.ini in php and apache folder.
I also include C:/wamp/bin/php/php5.3.8/ in windows $PATH variable.
But when I run pear command. It said it can not find the pear command.
I check the folder and just find a file called pear.bat and pear.ini.
I tried to run pear.bat again in command line. It still does not work.
Experts, please help on this issue.
Ok since many people may be asking the same thing. Let's suppose the following.
I'm currently running 2.2 E which includes Apache 2.2.22 – Mysql 5.5.24 – PHP 5.3.13 XDebug 2.1.2 XDC 1.5 PhpMyadmin 3.4.10.1 SQLBuddy 1.3.3 webGrind 1.0
Now, to install PEAR do the following:
Download this file:
http://pear.php.net/go-pear.phar
And put it on your WAMP server directory under the PHP version on the bin folder.
Run the command to install PEAR and you're over it.
Example (defaults, no change has been done)
Get the file on the link ->http://pear.php.net/go-pear.phar
Go to this directory C:\wamp\bin\php\php5.3.13
Open command prompt (cmd.exe). Supposing you're using Windows Vista and higher, press Start, type "cmd.exe" and right click on it and select run as administrator/CTRL+SHIFT+Enter (Haven't tested on non-priviliges rights)
Use Window's cd command to change the directory to the go-pear.phar file you've just downloaded. In my case I'll be pin pointing it to my own directory, so I did it like follows:
cd "C:\wamp\bin\php\php5.3.13"
Press Enter. You should note that instead of saying "C:\system\32" is now displaying C:\wamp\bin\php\php5.3.13
Write the following command and press Enter:
php -d phar.require_hash=0 go-pear.phar
Select whether you like or not a local copy or a system one. By typing system:local and pressing enter you'll install a local copy. By typing system and pressing enter you'll install a system-wide copy.
Type yes to confirm the option chosen.
The next list of directories, will be the referring directories that PEAR will install its components. If you select from 1 - 12 you can change the directory you'd like to install. By typing all and pressing Enter you'll be able to change them all in a queued manner. In my case, I just pressed Enter and left all defaults
DO THE FOLLOWING IN CASE YOU CONTINUE TO HAVE SOME LISTINGS
11. It is very probable that afterwards you'll receive a message like:
WARNING! The include+path defined in the currently used php.ini does not contain the PEAR PHP directory you just specified: If the specified directory is also not in the include_path used by your scripts, you will have problems getting any PEAR packages working.
Below it will also appear:
Would you like to alter php.ini ? [Y/n]:
Type y and press enter
This should put you running with PEAR on WAMP server :)
pear.bat is the executable on windows. You have to put that directory in your system's PATH variable for the command to be recognized.
All the steps mentioned to below link for GUI based - easy understanding review and setup:
Click here
For anyone looking for a more current answer. On Windows 10 I had to edit .bash_profile to add the following:
function __pear {
pear.bat $#
}
alias pear=__pear

Categories