I've followed various guides for this, but just cannot get moving.
I've checked I've got PEAR installed.
sudo apt-get install memcached php5-memcached
then
php -m | grep memcached
a2enmod has no modules that look like memcached. So. Really just stuck at this point. All the guides say it should magically appear, and it simple doesn't.
Right after the install I would check the state of the memcached with netstat:
netstat -pnatul | grep "memcached"
if the port and the pid are matches then:
telnet 127.0.0.1 11211 and when the prompt appears: stats and quit
if it works, then into the shell (it will be just the CLI):
php -r '(new Memcached())->addServer("127.0.0.1", 11211) == true ? print "OK\n" : print "NF\n";'
But as you described above, the php -m shows no memcached at all, with dpkg check if the installation was properly finished.
The dpkg -l | grep "php5" lists every php5 related packages.
If its there, I would look for the extension line:
find /etc/ -type f -exec grep -lF "extension=memcached.so" {} \;
It will shows all the file's names with path that contains the extension=memcached.so if it returns with nothing insert that line into your php.ini file or to a separate config file called like memcached.ini and make sure it loads. Reload the apache.
service memcached restart
service apache2 restart
(and don't forget to configure your memcached to listen on the correct host/port)
Related
We have 32 client databases, some are big, with millions of records (V.11. Currently, hosted and build on Mac's). I have build a website on Windows 2012 64x Server and included last version of PDO with PHP version that was stated (Xamp 2.5 with PHP/5.3.8 ). Plugin and Apache are 32x.
My web page connects to all 32 clients on 4d sql servers and runs few SQL select quarries. The problems I'm encountering are almost impossible to describe. On some search terms it sometimes works and sometimes not. What I mean, if I search for "jone doe" it does give me results, and if I change one latter it doesn't, SQL connect handler on client stays hanging and web page goes to timeout.
Note that there is no pattern. Some searches are hanging on one client. some on 2 or 3. Different search is same, but different clients. Only one Search for specific number of 13 characters is passing all clients and it's working perfectly. Let me also say I'm targeting specific tables and columns so I'm sure my SQL query is not a problem, I have few search boxes and they are all single search no OR or AND SQL, also I'm selecting about 4-6 columns to display results for that one select query.
Also, it's all on private network at work. So connections are not the problem also. I will add that results can be from 0 - 50 maximum per one connection. Here is stripped down sample of code:
Connections are defined up, this is rest of the code:
function trazi($dbaza) {
global $db; global $db2; global $db3; global $db4; global $db5; global $db6; global $db7;
global $db8; global $db9; global $db10; global $db11; global $db12; global $db13; global
$db14; global $db15; global $db16; global $db17; global $db18; global $db19; global $db20;
global $db21; global $db22; global $db23; global $db24; global $db25; global $db26; global $db27;
global $db28; global $db29; global $db30; global $db31; global $db32;
global $inime; global $inoib; global $inbb; global $inbbroj; global $insb;
$odabrani = $dbaza->prepare('SELECT STANJE, SUD_BROJ_O, SUD_BROJ_P, SUD_BROJ_JBR , NAZIV_LONG, OIB FROM PREDMETI WHERE SUD_BROJ_O = ? ');
$params = array($insb);
$odabrani->execute($params);
$rezultat = $odabrani->fetchAll(PDO::FETCH_ASSOC);
unset($dbaza);
unset($odabrani);
if ($rezultat) {
<th>Ime i prezime</th>
<th>OIB</th>
<th>Bilježnički broj</th>
<th>Sudski parnički broj</th>
<th>Sudski ovršni broj</th>
<th>Stanje predmeta</th>';
foreach($rezultat as $row) {
echo "<tr>
<td>".$row['NAZIV_LONG']. "</td>".
"<td>".$row['OIB']."</td>".
"<td>".$row['SUD_BROJ_JBR']."</td>".
"<td>".$row['SUD_BROJ_P']."</td>".
"<td>".$row['SUD_BROJ_O']."</td>".
"<td>".$row['STANJE']."</td>".
"</tr>";
}
echo "</table>";
} else {
echo "Vaša pretraga nije pronašla niti jedan rezultat.";
}
}
unset($rezultat);
//ATLANTIC
echo '<br><br><div style="color:#922E19">ATLANTIC</div>';
trazi($db);
ob_implicit_flush(true);
$buffer = str_repeat(" ", 4096);
echo $buffer;
ob_flush(); usleep(300000);
//CEDEVITA
echo '<br><br><div style="color:#922E19">CEDEVITA</div>';
trazi($db2);
ob_implicit_flush(true);
$buffer = str_repeat(" ", 4096);
echo $buffer;
ob_flush(); usleep(300000);
ETC...
I really hope that this PDO limitations are the problem because on some queries it selects too much data and breaks.
The problem: I have made changes to 4d PDO source files and changed limitations. But I cannot compile it neither do I know how. I don't have a PC, my server is of no use for this topic and I'm on Mac. Can someone please help me compile a DLL with this changes. I will attach a zip file with changes made.
http://forums.4d.fr/4DBB_Main/x_User/18851165/files/18851204.zip
Edit; or can someone compile me this version with bug fixes;
https://github.com/famsf/pecl-pdo-4d
I'm using PHP/5.3.8 32bits.
If anybody come across this thread the answer is here. Compiling works like it states and original driver is faulty after all. This versions works. I'm hosting my script on Ubuntu and compiled a new driver and its connecting to 32 databases with no errors.
You will need Ubuntu 12.04 and follow the code below.
# Install dependencies (You may need more)
sudo apt-get install php5-dev
# Clone a working version of the code from the FAMSF repo
git clone https://github.com/famsf/pecl-pdo-4d.git pdo_4d
cd pdo_4d
# Prepare the PHP extension for compiling
phpize
# Workaround acinclude.m4 pointing to incorrect header location.
# See: https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1393640
sudo ln -s /usr/include/php5/ /usr/include/php
# Configure the package to the system
./configure --with-pdo-4d
# Compile!
make
# Copy the extension to PHP's library
sudo make install
# Create php5 module configuration file for PHP 5.4/5.5
sudo sh -c "echo extension=pdo_4d.so > /etc/php5/mods-available/pdo_4d.ini"
# Enable the module for PHP 5.4/5.5
sudo php5enmod pdo_4d
# Enable the module for PHP 5.3
sudo sh -c "echo extension=pdo_4d.so > /etc/php5/conf.d/pdo_4d.ini"
# Restart apache
sudo apache2ctl restart
# Check for PDO_4D in the PHP CLI Information
php -i | grep 4D
You will just need to make your own folder for step below;
sudo sh -c "echo extension=pdo_4d.so > /etc/php5/mods-available/pdo_4d.ini
folder mods-available, and it will all do as its stated, before all this just install PHP and Apache but for that you can find many explanations on the web. It's just a one line command and Linux does the rest.
Also skip # Enable the module for PHP 5.4/5.5, because Ubuntu will have 5.3, and its all you need.
Compling PDO_4D for php 7.0. On ubuntu 16.04 32bits, 32 its important because driver was made for 32 systems, or at least i think its important...
First you need corresponding php version of driver and php.
I recommend this tested version of driver: http://git.thesecretgamer.de/faldon/pdo_4d.git
IMPORTANT : first upgrade and update your system before you install php and Apache because if you do it later it will install php 7.1 and driver didn't work for me.
//Installing server
sudo apt-get update
sudo apt-get install apache2
sudo apt-get install python-software-properties
sudo apt install php7.0-cli
sudo apt-get install php7.0-dev
sudo apt-get install php7.0-mbstring <--- for some reason you will need this, trust me.
sudo apt-get install libapache2-mod-php7.0
apt install git
//compilation
# Install dependencies (You may need more)
sudo apt-get install php7.0-dev <--- I did this in steps before so skip it.
# Clone a working version of the code from the FAMSF repo
git clone http://git.thesecretgamer.de/faldon/pdo_4d.git pdo_4d <----- or just unpack your modified driver with your changes where ever you wont.
cd /var/4d/pdo_4d <------- navigate to driver folder
# Prepare the PHP extension for compiling
phpize
# Workaround acinclude.m4 pointing to incorrect header location.
# See: https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1393640 <---- this may be fixed for php 7.0 but i did it anyway.
sudo ln -s /usr/include/php/20151012/ /usr/include/php
# Configure the package to the system
./configure --with-pdo-4d
# Compile!
make
# Copy the extension to PHP's library
sudo make install
# Create php module configuration file for PHP 7.0
sudo sh -c "echo extension=pdo_4d.so > /etc/php/7.0/mods-available/pdo_4d.ini"
# Enable the module for PHP
sudo phpenmod pdo_4d
sudo sh -c "echo extension=pdo_4d.so > /etc/php/7.0/apache2/conf.d/pdo_4d.ini"
# Restart apache
sudo service apache2 restart
# Check for PDO_4D in the PHP CLI Information
php -i | grep 4D
php -m
Now keep in mind there may be few unnecessary steps, but this works, I did it 4 times.
Credits go as mentioned in last post to Brad and this blog post with tutorial for php5. I just modified it for php7.0
I've been trying to install Symfony3 into Ubuntu 14.04 running in virtualbox and have been following this tutorial:
http://symfony.com/doc/current/setup.html
So far I can get the Symfony command installed. I try running the Symfony command to create an application under the /var/www/html/ folder - my Apache web directory - and the following error is thrown :
I want to set up my application in this folder as this is a shared folder to a Windows 10 host. I can install Symfony under my home directory and can access this from the host browser.
Personally I think it's a permissions issue. I did find this this page for help and did not get much success. Can someone enlighten me as to what's going on?
Did you run this command already:
HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
Run it under the /var/www/html/symfony_test directory and tell us the results.
You have no write permissions because /var/www folders are writable by apache user. In some case (often linux) apache user is wwwdata. In MacOs the user is _www.
You can also try with some trick. First one, is to avoid apache for your development: just install symfony in you ~/Development folder, and run ./bin/console server:run command. Symfony allow you to run the php builtin server.
I'm using Ubuntu 16.04 and I want to run php files.
I installed Php 7 on it using:
sudo mkdir -p /var/www/html
sudo chown -R $USER:$USER /var/www/html
sudo apt install php
sudo apt install apache2
I created a php file (e.g. test.php) in /var/www/html. I can access it in the browser (e.g. http://localhost/test.php). Instead of executing the <?php ... ?> code, it is displayed as plain text:
I tried to turn short_open_tag to On. So I edited the /etc/php/7.0/fpm/php.ini and enabled it.
Then I ran sudo service php7.0-fpm restart. This didn't make any change in the browser. The php code is still displayed as plain text.
How can I fix this?
You didn't install apache properly, doing an apt-get on apache2 does not install everything.
what #newman stated is correct you can follow that guide, or here is a digitalocean link that is usuable for production server (since you would do this on a droplet). Note this is full stack LAMP, which I would assume you would get to eventually when you want to dab with mysql
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04
This is kind of a n00b question, but I'm a much better developer than a sys admin.
Im setting up an Amazon Linux instance on EC2 and can't seem to get php 5.5 with mcrypt installed. yum seems to throw php 5.3 at me each time i try to do a group install or just as a dependency of mcrypt.
Any suggestions? This is for a Laravel 4.1 application.
Thanks!
If you are using amazon linux, you will need to install the php packages that start with php55.
Older packages are kept for compatability.
Since start configuring an EC2 instance can be tricky and indeed there is not much available support or documentation at the date I'm writting this answer, I'll post the steps I followed that worked for me. So I hope it will be useful to someone else:
Start an EC2 instance as described on the AWS documentation. Do not use elastic beanstalk for deploying your php app.
Start you PuTTY session, it is well described on the AWS documentation.
When PuTTY session is on, install in the following order: apache server (v 2.4), php55, php55-mcrypt, php55-pdo and mysql55
sudo yum install httpd24
sudo yum install php55
sudo yum install php55-mcrypt
sudo yum install php55-pdo
sudo yum install mysql55
Check your server properly working sudo service httpd start. If succesfully installed, you'll see 'OK' and you should be able to see a sample page in the public DNS.
Add a group in order to allow "ec2-user" modifying and writing files inside var/www/html
sudo groupadd www
sudo usermod -a -G www ec2-user
Exit PuTTY and reenter again (so changes will be applied) exit
Reconnect and check membership
groups
Modify permissions on writing and editing files
sudo chown -R root:www /var/www
sudo chmod 2775 /var/www
find /var/www -type d -exec sudo chmod 2775 {} +
find /var/www -type f -exec sudo chmod 0664 {} +
Test your server
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
sudo service httpd restart
visit http://publicdomain/phpinfo.php. If properly working (it should) it will display the php info page.
All these steps worked well for me after hours dealing with php versions that are not compatible with laravel 4.1>=
Is there any documentation about V8JS?
Do I need only standard PHP or some extensions to use V8JS?
I'll be very thankful for any information about V8JS in PHP.
Requirements
PHP 5.3.3+ and V8 library and headers installed in proper paths.
Install
I've found this docs on the v8js class.
The docs out there aren't complete or are not updated. I'm actually currently in the process of doing v8JS myself and it took me a few days to get the back end libs sorted out. First off, you must know that you can't do this is you have python < 2.7
Here is my install notes that I'm putting together for our dev vagrant boxes running centos 7.
cd /tmp
# Install depot_tools first (needed for source checkout)
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
# Download v8
fetch v8
cd v8
# Build (disable snapshots for V8 > 4.4.9.1)
make native library=shared snapshot=off -j8
# Install to /usr
sudo mkdir -p /usr/lib /usr/include
sudo cp out/native/lib.target/lib*.so /usr/lib64/
sudo cp -R include/* /usr/include
echo -e "create /usr/lib64/libv8_libplatform.a\naddlib out/native/obj.target/tools/gyp/libv8_libplatform.a\nsave\nend" | sudo ar -M
cd /usr/lib64
sudo chrpath -r '$ORIGIN' libv8.so
========================
Compile php-v8js itself
========================
cd /tmp
git clone -b master https://github.com/phpv8/v8js.git
cd v8js
phpize
./configure
make
make test
sudo make install
sudo service httpd restart
A note on the line make native library=shared snapshot=off -j8. I had the compile stop on me a couple times, I just restarted it. I'm not sure why it stopped, but it restarted just fine and completed just fine.
After that is done, you need to create the php extension file /etc/php.d/v8js.ini with the following content
; Enable v8js extension module
extension=v8js.so
Run the following to make sure it is installed correctly
php -r "phpinfo();" | grep v8js
If you get output back and no errors you're good to go.