Jump to content

ali_kiyani

Members
  • Posts

    61
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ali_kiyani's Achievements

Member

Member (2/5)

0

Reputation

  1. Yes you should use it. No idea about execution time but it is secure and the second point I posted above deals with it. Here is a very nice tutorial on what is PDO and how to use it. http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html
  2. 1. With PDO you don't need to write separate code when you change database. mysql_connect will only work for MySQL and not MS SQL Server or Oracle. For that you will need to use different methods. PDO solve this problem. 2. With PDO when you use parameters then all user input is automatically sanitized. You don't need to sanitize it.
  3. 1. No 2. Yes there may be several queries. But the thing is I am not sure if just some of those queries will create such a problem. Could it be due to something else like I/O wait!? 3. There are other applications also installed like cpanel, mail server e.t.c. who have their own databases so this is total of all tables not just my application.
  4. Hi, I have a dedicated server with following specs: 1. Two Intel Xeon-Harpertown 5430-Quadcore[2.66 Ghz] 2. 4GB DDRII RAM 3. 500GB SATAII HD 4. CentOS 5.5 64-bit Problem is that even with such specs MySQL still takes high CPU usage. It almost remain above 150% all the time and most of the time goes above 300%. I came to know about this after running "top" command. Now the thing is as soon as I run "watch mysqladmin pr" to see what's going on then I don't see any problem. Although there are queries running but they are not like some very heavy queries except may be one or two. I ran "mysqltunner.pl" and it showed me the following: -------- Storage Engine Statistics ------------------------------------------- [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster [--] Data in MyISAM tables: 362M (Tables: 255) [--] Data in InnoDB tables: 880K (Tables: 55) [!!] Total fragmented tables: 2 -------- Performance Metrics ------------------------------------------------- [--] Up for: 3h 26m 51s (1M q [138.122 qps], 43K conn, TX: 3B, RX: 246M) [--] Reads / Writes: 93% / 7% [--] Total buffers: 830.0M global + 3.9M per thread (300 max threads) [OK] Maximum possible memory usage: 1.9G (50% of installed RAM) [OK] Slow queries: 0% (47/1M) [OK] Highest usage of available connections: 6% (18/300) [OK] Key buffer size / total MyISAM indexes: 256.0M/169.9M [OK] Key buffer hit rate: 100.0% (5B cached / 36K reads) [OK] Query cache efficiency: 84.2% (1M cached / 1M selects) [!!] Query cache prunes per day: 338346 [OK] Sorts requiring temporary tables: 0% (989 temp sorts / 242K sorts) [!!] Temporary tables created on disk: 38% (160K on disk / 420K total) [OK] Thread cache hit rate: 99% (18 created / 43K connections) [OK] Table cache hit rate: 98% (446 open / 452 opened) [OK] Open file limit used: 1% (663/65K) [OK] Table locks acquired immediately: 99% (684K immediate / 684K locks) [OK] InnoDB data size / buffer pool: 880.0K/8.0M -------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance MySQL started within last 24 hours - recommendations may be inaccurate Temporary table size is already large - reduce result set size Reduce your SELECT DISTINCT queries without LIMIT clauses Variables to adjust: query_cache_size (> 64M) ------------------------------------------------------------------------------ As you can see most of the parameters are correct except a few like 2 defrag tables and small query cache size. Even if I fix this I don't see any noticeable performance increase. So now I have turned my attention to this "Temporary tables created on disk 38%" Do you think it is because of this MySQL is taking too much CPU time? How can I improve it? Or do you think there is something else after look at above result? Currently my setting regarding temporary tables in MySQL config file are: tmp_table_size=1000M max_heap_table_size=500M Even if I increase these values, MySQL still created temporary tables on disk. How do I fix it? I can see mysqltuner.pl also says that I need reduce my result set but if I give it plenty of RAM to create temp tables shouldn't the problem go away? Thanks
  5. Not exactly because when of my requirement is that the HTML source code when viewed in browser should display that translated language for SEO purpose. What they are doing is converting text after it is displayed in browser. I want to translate before something is displayed on page and only translated content is displayed rather than first displaying English content and then translating to other language. But what ever their technique is, I want to know how to break HTML in 5000 characters properly.
  6. Hi, I am trying to translate a page in PHP using Google API. There is 5000 chars limit on data that you can send to Google at a time. So I am trying to break the page into pieces of 5000 chars. But as you know while doing this we have to keep in mind the HTML formatting that it should not be disturbed otherwise you will not get desired results. For example you have to send this: <a href="#" class="myclass">Link</a> Instead of this: <a href="#" class="myclas I am able to solve it somehow (although not perfectly I guess) by checking if "<" sign is coming after ">" sign or not. If "<" sign is coming after ">" then I go back to the point where I found ">" and cut string from there. Anyway the point is I am still having some problems regarding HTML formatting and want to know how to do it efficiently. Is there any parser available that will solve this problem!? Thanks
  7. This did the trick. I browsed it directly and it was same blank page. Went to code and saw that I am missing "php" between these <?php echo....?> Problem solved. Many thanks!
  8. Hi, I have the following file structure /.htaccess /index.php /displaypage.php All files are on root. I have following written in .htaccess file Options FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-z0-9-]+)$ displaypage.php?page=$1 [NC,L] I have following written in displaypage.php echo $_GET["page"]; Now when I run http://localhost/ then it shows index.php page which is correct. If I run http://localhost/something then it shows a blank page. Previously it used to display that "page" variable on screen. mod_rewrite is enabled and I am using Windows with XAMPP. What am I doing wrong? Thanks
  9. Hi, I am using Snoopy class to read contents of a web page. But it doesn't perfectly simulate the browser because the content of web page changes when I use Snoopy to fetch it. And if I view it in browser directly then content is different. I even set the user agent string in Snoopy but still no luck. How can we perfectly simulate browser so it is indistinguishable whether we are using some script or a browser to view web page? Thanks
  10. I tried it but didn't work. It still only prints $_GET["page"] value and when I use print $_GET["sub"] then nothing is printed on screen.
  11. Hi, I have the following .htaccess file: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-z0-9-]+) displaypage.php?page=$1 [NC,L] Using it I can read URLs like this: www.mywebsite.com/cats www.mywebsite.com/cars www.mywebsite.com/computers Now I want to modify .htaccess file so it can also read the following: www.mywebsite.com/cars/bmw www.mywebsite.com/computers/pc Think of 'cars' as category and 'bmw' as subcategory. I want to read both but because of my current .htaccess file I can only read categories and nothing after it. Thanks
  12. Hi, Can I create a SOAP server without WSDL? I mean this is the scenario: 1. Client sends a parameter to server 2. Server checks in database and returns result to the client 3. Client displays result on screen So do I really need WSDL for that? Is there a way it should not require WSDL. Give me simple example code. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.