memcached on centos
Sat, 12/07/2013 - 13:35 — sandipBelow is a summary of steps taken to get memcache support for php:
1. Install memcached and php-pear for pecl support to download and compile memcache for php.
yum --enablerepo=epel install memcached php-pear
pecl install memcache
2. Configure memcached (/etc/sysconfig/memcached) and start it up:
chkconfig memcached on
service memcached start
3. Create /etc/php.d/memcache.ini file with the below contents:
extension=memcache.so
4. Reload apache and/or php-fpm processes:
service httpd reload
service php-fpm restart
5. Check with "php -i" or "phpinfo()" that memcache support is enabled.
6. Memcached listens to port 11211 by default. Status and stats:
memcached-tool localhost:11211 display
memcached-tool localhost:11211 stats
- sandip's blog
- Login or register to post comments
- Read more
easy php-fpm install via yum
Tue, 08/10/2010 - 14:10 — sandipOn CentOS, php-fpm can be easily installed via CentALT yum repository. This requires epel repository too and will pull down any dependencies if needed.
-
Install EPEL release:
rpm -Uvh http://download.fedora.redhat. com/pub/epel/5/x86_64/epel-rel ease-5-3.noarch.rpm
rpm -Uvh http://centos.alt.ru/repositor y/centos/5/x86_64/centalt-rele ase-5-3.noarch.rpm
yum --enablerepo=CentALT --enablerepo=epel install php-fpm
The default settings should work quite well.
Bring up the service via:
/etc/init.d/php-fpm start
php with mysqlnd support
Sat, 03/13/2010 - 02:11 — sandipYou can now get the latest PHP with mysqlnd (MySQL Native Driver) support via remis' yum repository as mentioned in PHP-5.3,-zts-and-mysqlnd. The blog mentions that this is enabld in php-zts. However, no php-pecl extension are available and neither are some of the extensions thread safe. So I went about rebuilding php package from source for mysqlnd support.
-
Download the source php rpm from http://rpms.famillecollet.com/
Install and apply the below diff patch to the spec file via `patch -p0 < {new_patch_file}` where "new_patch_file" has the below contents:
--- php-5.3.2-remi.spec.orig 2010-03-11 23:07:04.000000000 -0600
+++ php-5.3.2-remi.spec 2010-03-11 23:36:03.000000000 -0600
@@ -24,6 +24,7 @@
%global phpversion 5.3.2
# Optional components; pass "--with mssql" etc to rpmbuild.
+%define with_mysqlnd %{?_with_mysqlnd:1}%{!?_with_m ysqlnd:0}
%define with_oci8 %{?_with_oci8:1}%{!?_with_oci8 :0}
%define with_ibase %{?_with_ibase:1}%{!?_with_iba se:0}
%if %{?rhel}%{?fedora} > 4
@@ -677,6 +678,11 @@
%if %{?fedora}%{?rhel:99} >= 10
&nbs p; --with-system-tzdata \
%endif
+%if %{with_mysqlnd}
+ &nb sp; --with-mysql=shared,mysqlnd \
+ &nb sp; --with-mysqli=shared,mysqlnd \
+ &nb sp; --with-pdo-mysql=shared,mysqln d \
+%endif
$*
if test $? != 0; then
tail -500 config.log
@@ -704,8 +710,13 @@
&nbs p; --enable-dba=shared --with-db4=%{_prefix} \
&nbs p; --with-xmlrpc=shared \
&nbs p; --with-ldap=shared --with-ldap-sasl \
+%if %{with_mysqlnd}
+ &nb sp; --with-mysql=shared,mysqlnd \
+ &nb sp; --with-mysqli=shared,mysqlnd \
+%else
&nbs p; --with-mysql=shared,%{_prefix} \
&nbs p; --with-mysqli=shared,%{_bindir }/mysql_config \
+%endif
%ifarch x86_64
&nbs p; %{?_with_oci8:--with-oci8=shar ed,instantclient,%{_libdir}/or acle/%{oraclever}/client64/lib ,%{oraclever}} \
%else
@@ -725,7 +736,11 @@
&nbs p; --enable-fastcgi \
&nbs p; --enable-pdo=shared \
&nbs p; --with-pdo-odbc=shared,unixODB C,%{_prefix} \
+%if %{with_mysqlnd}
+ &nb sp; --with-pdo-mysql=shared,mysqln d \
+%else
&nbs p; --with-pdo-mysql=shared,%{_pre fix} \
+%endif
&nbs p; --with-pdo-pgsql=shared,%{_pre fix} \
&nbs p; --with-pdo-sqlite=shared,%{_pr efix} \
&nbs p; --with-pdo-dblib=shared,%{_pre fix} \
@@ -756,6 +771,16 @@
&nbs p; --with-recode=shared,%{_prefix }
popd
+%if %{with_mysqlnd}
+without_shared="--with out-gd \
+ &nb sp; --disable-dom --disable-dba --without-unixODBC \
+ &nb sp; --disable-xmlreader --disable-xmlwriter \
+ &nb sp; --without-sqlite \
+ &nb sp; --disable-phar --disable-fileinfo \
+ &nb sp; --disable-json --without-pspell --disable-wddx \
+ &nb sp; --without-curl --disable-posix \
+ &nb sp; --disable-sysvmsg --disable-sysvshm --disable-sysvsem"
+%else
without_shared="--without -mysql --without-gd \
&nbs p; --disable-dom --disable-dba --without-unixODBC \
&nbs p; --disable-pdo --disable-xmlreader --disable-xmlwriter \
@@ -764,6 +789,7 @@
&nbs p; --disable-json --without-pspell --disable-wddx \
&nbs p; --without-curl --disable-posix \
&nbs p; --disable-sysvmsg --disable-sysvshm --disable-sysvsem"
+%endif
# Build Apache module, and the CLI SAPI, /usr/bin/php
pushd build-apache
rpmbuild -bb --with mysqlnd --define "rhel 5" SPECS/php-5.3.2-remi.specTo install via yum, change to the directory where rpms are located and recreate the repodata via:
createrepo .
pecl runkit with php-5.2.x
Thu, 01/21/2010 - 16:11 — sandipAs of writing, the current pecl runkit-0.9 package does not compile with PHP 5.2+ . Below is how I got the latest installed from svn trunk on CentOS-5.4 with php-5.2.9.
-
Install runkit:
svn co http://svn.php.net/repository/ pecl/runkit/trunk/
&nbs p; cd trunk
&nbs p; phpize
&nbs p; ./configure
&nbs p; make
&nbs p; make install
extension=runkit.so
Note: you would need php-pear and php-devel installed already.
- sandip's blog
- Login or register to post comments
- Read more
Static compile of openssl, apache, mod_ssl and php
Tue, 02/26/2008 - 16:47 — wizapAs of this writing, the latest versions were:
-
apache_1.3.41
php-4.4.8
openssl-0.9.8g
mod_ssl-2.8.31-1.3.41
Once the files are downloaded and extracted; config, compile and install in the below order:
-
Install openssl:
$ ./config --prefix=/usr/local --openssldir=/usr/local/openss l
$ make
# make install
$ ./configure \
--with-ssl=../openssl-0.9.8g \
--with-apache=../apache_1.3. 41
$ ./configure
$ ./configure \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype \
--with-freetype-dir=/usr/lib \
--enable-gd-native-ttf \
--enable-memory-limit \
--with-ldap \
--with-mysql \
--with-apache=../apache_1.3. 41
$ make
# make install
$ SSL_BASE=../openssl-0.9.8g \
./configure \
--prefix=/usr/local/apache \
--enable-module=rewrite \
--enable-module=so \
--activate-module=src/module s/php4/libphp4.a \
--enable-module=ssl
- wizap's blog
- Login or register to post comments
Static apache-1.3.x and php-4.x compile for dotProject
Thu, 02/14/2008 - 12:26 — wizap-
Download and unpackage the source files:
$ cd /usr/local/src
$ wget http://www.ibiblio.org/pub/mir rors/apache/httpd/apache_1.3.4 1.tar.gz
$ wget http://us2.php.net/get/php-4.4 .8.tar.gz/from/us.php.net/mirr or
$ tar -xvzf apache_1.3.41.tar.gz
$ tar -xvzf php-4.4.8.tar.gz
$ cd apache_1.3.41
$ make clean
$ ./configure
$ cd ../php-4.4.8
$ make clean
$ ./configure \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype \
--with-freetype-dir=/usr/lib \
--enable-gd-native-ttf \
--enable-memory-limit \
--with-ldap \
--with-mysql=/usr/local/mysq l \
--with-apache=../apache_1.3. 41
$ make
# make install
$ ./configure \
--prefix=/usr/local/apache \
--enable-module=rewrite \
--enable-module=so \
--activate-module=src/module s/php4/libphp4.a
$ make
# make install
- wizap's blog
- Login or register to post comments
- Read more
Auto restart apache on segmentation fault error
Fri, 11/16/2007 - 16:36 — sandipRecently a particular folder in a site started coming up with blank php pages and the root cause being Segmentation fault after memory exhaustion. The subfolder contents would only come up after doing a restart of apache.
So something tried to access a region of memory that it did not have rights to. May be due to either bad RAM, or a code problem.
My first instinct was eAccelerator as I had done a recent php update and had not re-compiled it.
I still had the same issue the next day and bumped up the memory_limit from 16M to 32M in php.ini and from 32M to 64M in eaccelerator.ini .
Upgrading php on DirectAdmin Servers
Fri, 09/07/2007 - 15:26 — sandipDownload the source tar.gz file from php.net and place it in "/usr/local/directadmin/custom
Edit the "/usr/local/directadmin/custom
Then run:
# cd /usr/local/directadmin/customa pache/
# ./build clean
# ./build update
# ./build all
Restart apache when finished.
logging php errors on godaddy hosting
Fri, 07/20/2007 - 12:41 — sandipGodaddys' linux hosting allows for editing your own "php.ini" file and enables support for logging errors, good for debugging purposes when developing with php.
Add the below lines to php.ini in the document root, to log all errors:
error_reporting = E_ALL
log_errors = on
error_log = /home/content/p/a/t/pathto/htm l/error_log
You should also protect the php.ini and error_log file via .htaccess:
<FilesMatch "(error_log|php\.ini)$&qu ot;>
Order deny,allow
Deny from all
</FilesMatch>
- sandip's blog
- Login or register to post comments
Hosting multiple domains pointed to the same web-space
Thu, 05/31/2007 - 16:20 — sandipPlace the snippet of code in an index.php file to pull up a different web page for each domain pointed to the same web-space.
<?
$serverName = $HTTP_HOST;
$serverName = str_replace("www.",& quot;",$serverName);
$serverName = str_replace(".com",& quot;",$serverName);
$serverName = str_replace(".net",& quot;",$serverName);
$serverName = str_replace(".org",& quot;",$serverName);
if (!(empty($serverName))) {
include("./".$server Name.".html");
}
?>