Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Tuesday, March 08, 2011

An example file upload progress monitoring in Zend Framework 1.11

An example web application demonstrating usage of Zend_ProgressBar and jquery progressbar for monitoring progress of file uploads in Zend Framework 1.11.3.

Since file uploads are done to the folder APPLICATION_PATH/uploads, the application tries to create this folder if it does not exists. For this reason APPLICATION_PATH should be writable, or uploads folder created manually with necessary rights. The application also requires 'uploadprogress' PECL package since it uses 'uploadprogress_get_info' function for getting the information about upload progress.



The source code is at GitHub. Most action happens in indexController.php and index.phtml.

Sunday, February 27, 2011

An example of OpenID, Facebook and Twitter authentication in Zend Framework 1.11

This is an example Zend Framework 1.11.3 application that uses OpenID (Google,
Yahoo, MyOpenId, AOL, OpenId) as well as Facebook Connect and Twitter Oauth for
authentication of users.

During authentication, information about a user (e.g. an email or a country) is fetched from the authentication provider.

Zend Framework 1.11 does not have a very good support for OpenID, not mentioning Facebook Connect and Twitter Oauth. Thus, to make it all work the following elements were used:
In some cases slight modifications to the above elements were made.

The demo of this application is here , while the source code is at GitHub. The user authentication is performed in a loginAction in UserController.php.

Hopefully, this example application will be useful to others as it was for me.

Sunday, February 06, 2011

Drupal 7: Add last update date to the footer of the page

I needed to add a date of last modification of the website made in Drupal 7. I did it by enable core module PHP Filter and creating a block located a footer block region. The body of the block was as follows:
<?php
// get date of most most recent change to a node
$result = db_query('SELECT title, changed FROM {node} WHERE status=1 ORDER BY changed DESC LIMIT 1');
$node = $result->fetchObject();
$date = date('d-M-Y g:i a', $node->changed);
echo "Last update: $date";
?>

Saturday, January 22, 2011

Pear run-tests: Setting --cgi option to test file uploads using phpt

In PHP, file uploads can be tested using phpt files as explained here. However, when I wanted to execute phpt test with --POST_RAW-- or --POST-- sections, pear run-tests was giving an error that: --cgi option needed for this test, type 'pear help run-tests' My phpt file was as follows: The layout of phpt files is explained here. To overcome this problem I installed php5-cgi package for ubuntusudo apt-get install php5-cgiThis allowed for correct execution of the testpear run-tests --cgi=/usr/lib/cgi-bin/php5 example-upload.phpt
Running 1 tests
PASS Example test emulating a file upload[example-upload.phpt]
TOTAL TIME: 00:00
1 PASSED TESTS
0 SKIPPED TESTS

Sunday, December 06, 2009

Installing xdebug in xampp (lampp) on fedora 12

xdebug is a PHP extension for powerful debugging. It supports stack and function traces, profiling information and memory allocation and script execution analysis.

By default xampp-linux-1.7.1 does not come with this extension. Therefore, it is necessary to install it.

First, assuming that there is already xampp-linux-1.7.1 installed in /opt/lampp it is necessary to download xampp development package. In my case it was xampp-linux-devel-1.7.1.tar.gz and unpack it
su
tar xvfz xampp-linux-devel-1.7.1.tar.gz -C /opt


Second, install autoconf package (as a root) yum install autoconf


Thrid, xdebug can be installed (as a root)/opt/lampp/bin/pecl install xdebugIf compilation was successful you should get Build process completed successfully
Installing '/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.0.5
configuration option "php_ini" is not set to php.ini location
You should add "extension=xdebug.so" to php.ini
Finally, localization of xdebug.so should be added to php.ini. In my case, xdebug.so was in opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/. This extension should be added using "zend_extension" and not "extension", therefore, you should ignore the prompt about adding "extension=xdebug.so" to php.ini. Hance, add the following line to /opt/lampp/etc/php.ini restart your lampp server
zend_extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
If everything went wine, using phpinfo() you should get:

Thursday, December 03, 2009

PHP: Generation of MD5 hash for HTTP digest access authentication

HTTP Digest access authentication is one of the agreed methods a web server can use to negotiate credentials with a web user (using the HTTP protocol). Digest authentication is intended to supersede unencrypted use of the Basic access authentication, allowing user identity to be established securely without having to send a password in plaintext over the network. Digest authentication is basically an application of MD5 cryptographic hashing with usage of nonce values to prevent cryptanalysis.

For example, lets assume that we want to allow a user called "adminuser" access a realm called "Admin Realm" with a password "secretpassword". Using php command the MD5 hash for this can be generated using:php -r 'echo MD5("adminuser:Admin Realm:secretpassword")."\n";'This gives the following MD5 hash:3228e0b5f8ae5ffb249d16125baffe63Therefore, for example when using Zend_Auth in Zend Framework, a file e.g. 'files/passwd.txt' with the username,realm and password that has to go into a resolver Zend_Auth_Adapter_Http_Resolver_File can containadminuser:Admin Realm:3228e0b5f8ae5ffb249d16125baffe63


In case of basic authentication, in 'files/passwd.txt' we would have password in a plain textadminuser:Admin Realm:secretpassword

Thursday, November 26, 2009

Zend Framework: Returning pdf file from an action controller

Lets assume that we have an action called getpdfAction in a Zend Controller. When we execute the action in a browser (e.g. http:://www.oursite.com/somezfcontroller/getpdf), the Zend Application by default will render view associated with the action and if necessary layout. However, when we want to have a pdf file returned or any other file from the action this behaviour is not needed. So, before we read a pdf for returning, we have to disable view script and layout rendering. This can be done as in the example getpdfAction function below:public function getpdfAction() {

//Disable rendering of view script and layout
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();


// We'll be outputting a PDF
header('Content-type: application/pdf');

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');

// The PDF source is in original.pdf
readfile('some_pdf_file.pdf');
}

Sunday, October 18, 2009

xampp / lampp: upgrade PHPUnit in lampp 1.7.1

The default PHPUnit that ships with lampp 1.7.1 is not suited for use with Zend Framework 1.9. The reason is that the PHPUnit version in lampp is to low. So it is necessary to upgrade it using pear. However, before it can be done, pear version that comes with lampp 1.7.1 needs to be also upgraded. The pear executable is in /opt/lampp/bin so I went to this folder.

First PHPUnit channel must be added sudo ./pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded


Then pear chanels can be updated sudo ./pear update-channels

Then we can try to install PHPUnit:sudo ./pear install phpunit/PHPUnit
phpunit/PHPUnit requires PEAR Installer (version >= 1.8.1), installed version is 1.7.1
phpunit/PHPUnit requires package "pear/Image_GraphViz" (version >= 1.2.1), installed version is 1.1.0
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
No valid packages found
install failed


To upgrade pear I used sudo ./pear upgrade PEAR To check if upgrade was successful I used ./pear -V
PEAR Version: 1.9.0
PHP Version: 5.2.9
Zend Engine Version: 2.2.0
Running on: Linux arch 2.6.31-ARCH #1 SMP PREEMPT Tue Oct 13 13:36:23 CEST 2009 i686


Before PHPUnit can be upgraded, pear/Image_GraphViz package must be upgraded first. So sudo ./pear upgrade pear/Image_GraphViz
downloading Image_GraphViz-1.2.1.tgz ...
Starting to download Image_GraphViz-1.2.1.tgz (4,872 bytes)
.....done: 4,872 bytes
upgrade ok: channel://pear.php.net/Image_GraphViz-1.2.1

and install PHPUnit ./pear install -a phpunit/PHPUnit
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
downloading PHPUnit-3.4.1.tgz ...
Starting to download PHPUnit-3.4.1.tgz (326,659 bytes)
...................................................................done: 326,659 bytes
install ok: channel://pear.phpunit.de/PHPUnit-3.4.1

After this, when I could use PHPUnit with Zend Framework as described in a tutorial here.

Wednesday, October 07, 2009

Xampp: SQLSTATE[HY000] [2002] Invalid argument

I'm currently developing a web application using Zend Framework 1.9.x. For this purpose I used Xampp for linux (i.e. lampp 1.7.2). Most of the time I was using arch linux with xampp 1.7.2 and there was no problem. Then I changed my os to Ubuntu 9.04 and I installed the same xampp 1.7.2. Interestingly, when I wanted to run my application under Ubuntu I got an errorMessage: SQLSTATE[HY000] [2002] Invalid argumentAfter googling I found that the reason was that in my php.ini (i.e. for xampp it is /opt/lampp/etc/php.ini) the variable pdo_mysql.default_socket was not set: Therefore I set it to /opt/lampp/var/mysql/mysql.sockOf course, I also had to restart Xamppsudo /opt/lampp/lampp restartIt is interesting why Xampp 1.7.2 worked under Arch Linux, but it did not work under Ubuntu 9.04?

Sunday, September 27, 2009

TOP PHP frameworks in terms of number of books published on a given framework

To begin with, I would like to say that I'm not new to PHP 4 and 5, but I would not call myself an expert. The reason is that for a few years now, PHP and web applications are things that I do only in my spare time. I also haven't used all the PHP frameworks, nor I'm the expert in any of them. I'm basically looking for a framework that is worth looking into and which would save me a time, as I don't want to spend much time on weekends coding e.g. only user authorization or registration form validation. So far, I did some small jobs using Prado, CakePHP and now I'm starting to learn Zend Framework. I also heard lots of good about CodeIgniter and Symfony. Since, I couldn't learn all of them, I just wanted to find some way of determining which of them seems to be the most popular. I decided to check how many books on a given framework are available in amazon.com?

I chose this criterion because for a person that wants to learn a framework, examples along with explanation can be valuable. Apart from official tutorials, quick start guides and reference manuals, that are available on the websites of the frameworks, books can provide good introduction along with example applications. Additionally, a number of books, also shows to some extend, how popular a given framework is. I would imaging that not many authors would write books about unpopular frameworks. Off course, there are many other possible criteria that can be used to rank or compare PHP frameworks, such as documentation, community support, performance, fast availability of updates etc., but I think that the number of books somehow translates to the the popularity of a framework.

Method of comparison

I went to amazon.com and I performed advanced searches for books on a given framework written in English and published after 2007. A year 2007 was chosen because books older than two years may contain highly outdated information. A framework name was a keyword. Than, the number of books found was counted.

En example of a search criteria used is given below:

Results

The results are as follows:
Zend Framework - 10 books (see the books)
Symfony - 9 books (see the books)
CakePHP - 3 books (see the books)
CodeIgniter - 2 book (see the books)
Prado - 0 books (see the books)

My personal opinion

From my perspective, the experience that I had with Prado (I used v. 3.1.4) was the worst one, although it's concept was interesting. I found it difficult to learn and use, because the documentation was sparse, there were not many tutorials, and even if I was wiling to invest some money and buy a book about it, I could not find any books about it.

After Prado I tried CakePHP (I was using v. 1.2). I found it very good, easy to learn and fast to use, as long as I adhered to all the naming conventions. Especially, I liked the ORM (Object-Relational Mapping) which was very useful and saved me a lot of time. The problem I had with it, was that it uses PHP 4, which already has been discontinued. Off course, sooner or later CakePHP will move to PHP 5, but I wanted to use a PHP 5. I think it would be better to use something in PHP 5, rather than something that is developed in a version of language that is already not supported. Off course, CakePHP runs smoothly on PHP 5. It is only CakePHP's core that does not use features of PHP 5. Additionally, I wanted to have more freedom when programming, and CakePHP does not allow for much of it due to it's "convention over configuration paradigm". But this is a price that you pay in CakePHP.

At the moment I'm learning Zend Framework v1.9 which is build using PHP 5. For now, I can say that it is definitely more difficult to learn at the beginning. The biggest issue that I had at the beginning, and still have but to a lesser extend, is a bootstrap class, which is difficult to understand. It really took me a long time to begin to understand how to use it at the simplest level. However, what I like is, that Zend Framework is less rigid than CakePHP, it uses PHP 5, and it has a vast number of tools (e.g. for working with PDF files or captcha) that CakePHP does not have.

I don't have experience with Symfony and CodeIgniter, so I cannot say anything apart from what I read in the Internet. CodeIgniter is considered to be faster than CakePHP and just like CakePHP, it is written for PHP 4, whereas Symfony is for PHP 5 only.

In conclusion, it seems that when you look only at the number of books on a given framework, Zend Framework is the winner with eight books. At the moment, I'm trying to get to know it, hopping that it will not be a waste of time. It must be remembered though, that there are many other criteria that can be used to compare PHP frameworks. However the final decision which framework to choose, if any, should be based on the specific needs of a project that we want to developed.

Monday, June 15, 2009

Kyoto subway

Recently I visited Kyoto (Japan) for business. Before the visit I was looking for some info about how to use subway, if there are English signs and is it easy to use for a foreigner (yes, its very easy!). I could not found much info about this, so when I was in Kyoto I decided to take some pictures of Kyoto subway station next to my hotel.

I was using everyday Karasuma Line to get from my hotel (i.e. Gimmond hotel - it have no complains about this hotel) to my destination. The Gimmond hotel is just next to station K08 (i.e. Karasuma Oike). So I took some pictures from this station:





Kyoto subway map


This map is taken from this website.

Buying tickets


To my surprise using tickets wending machines, buying tickets and using subway was very easy. So I was basically traveling from station K08 to station K01 (the cost was 280 yen) and from K08 to K11 (i.e. main Kyoto station, cost 210 yen). So to use the subway we off course need to buy tickets. This is done using tickets vending machines available on each station:

To buy tickets it:

1. First check how expensive tickets you have to buy for your destination. You do this buy analysis subway map board above the wending machines (see above picture).

2. Put required amount of money to the wending machine. You can put more. For example if you want to go from K08 to K01 it costs 280 yen. You can put 500 yen coin or a 1000 yen bill into the wending machine or more. The machine will return you the change.

3. Once you put some money into the machine, the machine shows you the available tickets for this price:
4. You select thicket that you want and you collect the ticket and change if necessary:

5. When you have tickets you go to subway gates and use it there to "tag in". At your destination you use it again to "tag off". Or just follow the crowd:-) It's worth noticing that at the destination station when you "tag off" your tickets is automatically taken by the gate, so you loose it. If you want to keep it and have a recite, because for example you want a refund from your company for the tickets, you should not "tag off" using gates. Instead go to a booth next to the gates, there will be a subway stuff person and ask him for a recite. He will give you a red, rectangular stump on your ticket (see below):

Basically there are no problems using the subway in Kyoto. There are plenty of English signs next to Japanese ones, so everyone that knows a little bit of English should be fine. The only challenge at the very beginning might be buying tickets, but I hope that my post will help with this.

Some other sites in English about Kyoto public transport

http://www.city.kyoto.jp/koho/eng/access/transport.html
http://www.japanvisitor.com/index.php?cID=424&pID=1730
http://urbanrail.fotopic.net/c1174303.html

Thursday, April 16, 2009

TYPO3: Enable realURL

By default typo3 uses URLs such as this: index.php?id=45. This is not very useful, it does not look good and is not "search engine friendly". Therefore it would be nice to havehttp://www.mysite.com/contact/instead of http://www.mysite.com/index.php?id=45In typo3, to do this you need to have RealURL extension installed. As I remember I had no problems installing it, or maybe it is installed by default, I'm not sure. Anyway, although installation of RealURL was easy, it was not so easy to make it work. I was creating some simple site using typo3, and I needed the most simple way to translate my address (e.g. from /index.php?id=45 to /contact/). The manual on the RealURL website is not so easy to understand, and it seems to be not updated (RealURL wiki seems to be better). For example in TypoScript configuration section the manual, it is said that we should set the following variable in TypoScript template recordconfig.baseURL = 1Unfortunately doing this results in an error: Unsupported TypoScript property was found in this template: "config.baseURL="1": The current version of typo3, at the moment of writing this, was 4.2.2!. So it seams this manual was not updated for a while. To solve this, in my case I needed to set this variable toconfig.baseURL = http://www.mysite.com/

Threfore, it took me a while to make this simple translation work. So what I did?

First, I made sure that mod_rewrite module was installed and working in my Apache (I had ubuntu-server 8.04 LTS and typo3 4.1.2). How exactly? There is plenty of information how to do this in the Internet, so I will not repeat it. Sorry:-).

Second, I enabled .htaccess in the root of your TYPO3-installation directory that comes with typo3 mv _.htaccess .htaccess

Third, I added config.simulateStaticDocuments = 0
config.baseURL = http://www.mysite.com/
config.tx_realurl_enable = 1
to in the TypoScript record. This record is in Template menu for root page of your site three, i.e. With this, if everything is ok, your realURL should already work! For me, it translated addresses from http://www.mysite.com/index.php?id=45tohttp://www.mysite.com/45

Forth, the manual says that file typo3conf/localconf.php should be edited for definition of translation rules. But for me it was enough to make aliases for each page to have e.g. "contact" instead of number 45:I did not have to edit localconf.php file. Thought, for more advanced translations probably you have to edit it.

Because I'm not sure whether I modified .htaccess I attach it here. localconf.php is also attached here.

Wednesday, March 11, 2009

Linux: Error while loading shared libraries

Just indicate the folder containing the library:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/folder/with/lirbary To check what libraries are used by a given program, one can use ldd:ldd ./ls971_mpphpmpi.e110
libmpio.so.1 => not found
libmpi.so.1 => not found
libdl.so.2 => /lib64/libdl.so.2 (0x0000003874a00000)
libm.so.6 => /lib64/libm.so.6 (0x0000003874600000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003885800000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003885400000)
libc.so.6 => /lib64/libc.so.6 (0x0000003874200000)
/lib64/ld-linux-x86-64.so.2 (0x0000003873200000)

Friday, February 13, 2009

PHP: Check if PHP sessions are working

Sometimes, there can be some problems with sessions in PHP. In such cases, it is useful to have a very simple and short script that can be used to check if session variables are created, saved and deleted correctly. The following two files can be used:
index.php<?php
session_start();
$_SESSION['user']='tom';
$role = "admin";
session_register('role');
?>
<html>
<body>
Created session variables are:
user='<?=$_SESSION['user']?>' and role='<?=$_SESSION['role']?>'<br><br>
<?='<a href="print.php">Check if session variables are saved</a>';?>
<br><br>
Session ID is: <?= session_id(); ?>

</body>
</html>

print.php<?php
session_start();
if (isset($_GET['delete'])) {
session_unset();
//$_SESSION = array();
session_destroy();

}
?>
<html>
<body>
Saved session variables are:<br><br>
user:<?=$_SESSION['user'];?><br>
role:<?=$_SESSION['role'];?>
<br><br>
Session ID is: <?= session_id(); ?><br><br>
<a href="?delete=1">Delete session</a><br><br>
<a href="index.php">Go back</a>
</body>
</html>
The screenshots are:
index.php:
print.php:
After clicking 'Delete session':

Download

The above scripts can be downloaded from here.

Sunday, February 01, 2009

CakePHP: Image Upload

Searching the web for some image upload component for cakePHP I found the following article: Image Upload Component (CakePHP) - Labs. Although this article is very useful, it was written over a year ago and unfortunately, the code of the image upload component available for download did not work straight away for me (I tested it using CakePHP 1.2.1.8004 Stable on xampp 1.7 for linux on Ubuntu 8.10). Some problems were: lack of index action in images controller, some unknown helpers (i.e. labelTag), missing model for images table, typo errors in view file upload.thtml, id field in images table was not a primary key, and some others. Three example screenshots are below:



Therefore, to make this component work I had to perform some modifications. Although, this component can be improved in may ways, I only made modifications necessary to make this component work. I did not perform full test of this componet. I just made it work, i.e. it is possible to upload images now (at least for me now).

Download

The modified image upload component is here. Hope it works and it will be useful. In a similar way I also modified component for the multiple file upload. It can be downloaded from here.

Wednesday, January 21, 2009

oMedia cms: Potential SQL inject vulnerability

oMedia is a Polish cms for shearing multimedia files. During some modifications of this cms, I found that there might be possible SQL injection vulnerability. Specifically, the problem is with the search panel. For example, performing a search for a file using a string that contains single quote (') results in the MySQL error:The error shows full MySQL command! This might be a potential for SQL injection attacks on the websites using this cms. Please don't panic! I'm not saying that there is vulnerability, I'm just pointing out that there might be vulnerability.
The solution to this problem is quite simple. In a file searchFile.php the following code foreach ($keywords as $keyword) {
if ($i > 0) {
$filter .= ' OR ';
}
$filter .= "f.name LIKE '%$keyword%' OR f.description LIKE '%$keyword%' ";
$i++;
}
should be changed to this:foreach ($keywords as $keyword) {
$keyw=addslashes($keyword);
if ($i > 0) {
$filter .= ' OR ';
}
$filter .= "f.name LIKE '%$keyw%' OR f.description LIKE '%$keyw%' ";
$i++;
}
The above solution simply adds addslashes() function. Hope this works.

Tuesday, January 13, 2009

Prado framework: problems running demo applications

PRADO is a component-based and event-driven programming framework for developing web applications in PHP5. Beginners wanting to learn Prado may have problems when they want to run demo applications on their own server. Some demos simply don't work. Particular, I had problems on xampp 1.7 for Windows with AJAX Chat, address-book and northwind-db demos. The problem is that they use sqlite3 database and they require pdo_sqlite and php_pdo_sqlite PHP extensions. However, the PHP in xampp 1.7 for Windows(PHP 5.2.8) a comes with these extensions for only sqlite2, not sqlite3!. For that reason when I tried to run e.g. AJAX Chat demo I got the "DbConnection failed to establish DB connection: could not find drive" error:
The solution to this problem was, at least for me, to convert sqlite3 databases of these demos to sqlite2.

AJAX Chat demo

The online example of this demo is here. As previously indicated, when I wanted to use the demo I was greeted with DbConnection error. This indicates that there is some problem with database connections. AJAX Chat demo requires pdo_sqlite extensions. So first thing that I did was to check if my PHP has such extensions. Before proceeding I made sure that these extensions were enabled in php.ini or php5.ini. To check if I have these extensions I used <?PHP phpinfo();?>. These resulted, among other things, with the following:This cleary shows that my pdo_sqlite driver is sqlite2. For that reason I converted the chat.db database of the AJAX Chat demo from sqlite3 to sqlite2 as follows:sqlite3 chat.db .dump | sqlite chat2.dbNext, in application.xml I made the following change from to
Following these changes the AJAX Chat demo finally worked:

Address-book demo

Online demo is here. The problem with this demo was the same as with the AJAX Chat demo, i.e. sqlite database. Since the demo uses Flex the error message was little different:To make it work, I converted the demo's sqlite3 database to sqlite2 database as follows:sqlite3 sqlite.db .dump | sqlite sqlite2.db. Next application.xml was modified as before and the demo worked:

northwind-db demo

The problem with this demo is the same as before. However, this time converting sqlite3 database to sqlite2 database resulted in errors. In another worlds, I could not convert the demo's database. The reason was that the demo's database is much more complicated than that of address-book and chat demos, and sqlite2 returned syntex errors when dumping. At the moment I'm still analyzing AJAX Chat demo, so northwind-db demo is far ahead. When and if I get to it, I try to find some solution this problem.

Download of chat2.db and sqlite2.db

The two sqlite database created are here.

Sunday, January 11, 2009

oMedia cms: adding suggestions to the search panel

oMedia is a Polish cms that is used for websites that provide image and movie files (something ala YouTube). Although it has many useful functions, performing a search for a file on the websites using the cms is not straight forward. The reason is that the search input filed does not provide suggestion while the users writes the query. Hence, I looked into the code of the cms and I modified it. This modifications required changing two files: searchFile.page and searchFile.php. Since oMedia is build on top of Prado framework, it was necessary to change TTextBox component in searchFile.page into TAutoComplete component and modify corresponding searchFile.php.
The modified two files can be downloaded from here. Therefore, to use the files it is necessary to substitute the two files on one's server (there are located in protected/panels/). Of course be sure to make copy of the original files before substitution. Additionally if the original files had already been modified, the two files must be modified manually.

Sunday, December 14, 2008

Some free, essential e-books

I have just found some free e-books source on www.techotopia.com. There are books such as:
  • JavaScript essentials
  • Ruby essentials
  • PHP essentials
  • MySQL essentials
  • Xen essentials
  • and more.

Monday, July 24, 2006

Your PHP installation appears to be missing the MySQL which is required for WordPress

Yesterday I went to this blog and I see:

Your PHP installation appears to be missing the MySQL which is required for WordPress.

I was quite suprise to see it, couse I hadn't been doing anything with my server configuration before, and yet something happend and this site was not working. What's more, my apache, php, mysql, phpmyadmin were working perfectly.

So, I did a little bit of googling, and I found solution on wordpress officiale site here.

I needed to add those lines just before mysql test in wp-settings.php:

if (!extension_loaded('mysql')){
if (!dl('mysql.so')) {
exit;
}
}

I also tried the second possible solution listed there, but it wasn't working.