Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
When using mysqli or PDO in a PHP script what are the mechanics that take place for the sql query to run?
Does the mysqli module run shell_exec() with a mysql command? I'm sure there is something more here.
Edit
More specifically what I wanted to know was what is the process that PHP takes to actually make a MySQL call, what are the mechanics involved for PHP to have access to the database.
There is a thing called Mysql C API.
Both PHP extensions are written by implementing low-level C functions from this API.
It connects directly over a socket to the server. There is no way to have connection pooling if you're just doing shell_exec(), which you may have noticed is an option. Not only that, but running another executable for every single query is insanely slow. As the other answer has mentioned, PHP uses C-bindings for Mysql which do all the hard work reading/writing sockets.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
NOTE: This is not about which better database, not at all.
Hi, my client has a shared host with the following stack:
PHP: 7.x.x
MySQL: 5.6.x
Postgres: 9.2.x
PhpMyAdmin
PhpPgAdmin
I'm able to use both MySQL(PHP) and PostgreSQL(C#, Go, Python, JS), but I personally prefer Postgres, also my client's host specs make it harder to use some SQL features like CTE which have no support in MySQL 5.6 (I know 8.0 has them).
The problem:
I plan to use Postgres, but I'm a little concerned about the combination of PHP+Postgres, since it seems that most PHP development is coupled with MySQL, for example, PhpMyAdmin is activly developed compared to PhpPgAdmin (the last release from 2018), also it seems it ALWAYS assumed that PHP runs using MySQL while Postgres is like a second citizen.
So, in your experience, should I go with Postgres or MySQL, to minimize the trouble that may arise?
Thanks.
I have used php with postgresql for about 20 years off and on. The driver is stable enough. You lack built-in support for some of the fancier data types in PostgreSQL (or used to anyway) - ranges, arrays etc.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
Any specific reason we are not using php in Hadoop framework?
There's nothing stopping you from using PHP for Hadoop Streaming MapReduce (assuming PHP can read from standard input and write to standard output).
And there's also not much preventing PHP from being able to query HBase or Hive or Spark Thrift Server assuming a driver exists that allows for that.
The only main issue is that you cannot use the core Java libraries very easily and most services would need exposed via REST, for example.
Any Hadoop web UI could probably be rewritten in PHP, if needed, but it's too much context switching, in my opinion.
A libhdfs C extension does exists, I've not seen it widely used. If you did want to interact directly with HDFS, that's probably the most performant way. Webhdfs would be an alternative
But you'd have to ask the core Hadoop developers why PHP isn't used.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is there a way in the server-side to execute once an operation instead of execute it every time when I sent a PHP request?
For example, I have an website that makes a lot of requisitions, but its independent from user or anything else, it just depends on the application running in the server with wich I'm willing to manage with my website.
So I want a way to just get the data that I need, processed by a script in the server not by every PHP request, i.e. The server will execute the only once and then I can grab the data with PHP.
As lonut suggested use cronjob (linux) or task manager (windows) to run you PHP task at specific intervals.
You can run standalone php script from the command line by using php path/to/your/script.php
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
PHP was originally made to interface with MYSQL. I'm wondering what is the difficulty level and how the best way to go about using PHP with SQL Server 2008 r2 is. I've done some research and it seems like there are some usable libraries. Is this something that is feasible on the production level?
PHP has a library for dealing with MSSQL (http://php.net/manual/en/book.mssql.php). You also might consider using something like PDO with its appropriate driver (http://www.php.net/manual/en/ref.pdo-sqlsrv.php) if you would like a more abstracted library to work with.
There is a SQL Server driver that works under windows: http://www.microsoft.com/en-ca/download/details.aspx?id=20098
http://php.net/manual/en/book.mssql.php
take a look at http://puurunen.ca/blog/?p=139
You should find there some info on sql server 2008 r2 PDO implementation
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
In the middle of 2010, I found a class library called PHPToCLib. It ran flawlessly for over a year - I was able to implement a tremendous amount of my own, custom code into a an AIM Bot that I could run from my CMD Prompt. However, near the end of 2011, the servers stopped responding to the script. It connects to toc.oscar.aol.com on port 5190, and that hasn't been changed. I am indeed aware that AOL discontinued their TOC2 servers and that it's not possible to connect with them anymore. However, I downloaded a program called TerraIM that uses the same specifications and is somehow able to connect to them. I was wondering if there were any updates on how I could get my script to connect, and if so, what do I need to change?
Thank you in advance.
TerraIM also supports the OSCAR protocol which I assume it's defaulting to. If you are working with IM bots the absolute best way to go is to leverage libpurple. Unfortunately there is not a good PHP binding to libpurple. There are a couple python bindings. If you don't wish to migrate your code, there is an implementation that provides an HTTP interface which may be easy to integrate with depending on your use case. Alternatively, you could use thrift to comminute between your existing PHP code and the python bindings -- this would require a bit more coding than leveraging an HTTP interface. Here are some resources you may find helpful:
Python bindings:
github.com/fahhem/python-purple
github.com/Raptr/Heliotrope
HTTP interface from HTTP binding:
github.com/atamurad/http-purple
Thrift:
http://thrift.apache.org/