Sqlrelay framework on PHP environment, inconsistency between web and cli - php

all.
I'm configured sqlrelay to manage mysql server's pool as the query traffic goes high.
(http://sqlrelay.sourceforge.net/)
I was happy when I successfully installed sqlrelay on my machine, but it does not properly working so far..
For your information, I've installed apache and php, mysql using YUM on centos 6.3.
The thing is, when I see phpinfo() on console (php -i), it prints sql_relay's information in middle of the output. (and query statement using sqlrelay is working well!)
When I see phpinfo() on webpage, however, there is no sql_relay section through the page.. and of cource, query statement using sqlrelay does not working at all.
anyone can help me out to address this issue?

Some time has passed, but here's a suggestion for anyone interested. In the first section of phpinfo() output I'd first check that the php.ini where the module is loaded are included. Depending on the configuration you may have a different php.ini for every virtual host.

Related

Need help in configuring WAMP (phpMyAdmin)

So I have been looking on the net for hours now and I can't solve my problem.
I have wamp installed (WampServer Version 3.1.7 64bit).
I want to open phpMyAdmin through wamp. (I have the phpMyAdmin5.0.2 installed and phpMyAdmin.conf is configured).
I have several php versions installed.(this was done through the process of trying to fix the solution alone).
When I try to open phpMyAdmin I get this error message: [1]: https://i.stack.imgur.com/ZEMaX.png .
I have tried configuring php.ini file (by de-commenting mysqli) it didn't change a thing.
Here's my php.ini file joined in the google drive link: https://drive.google.com/file/d/1fQuVoh5vhRX-MHhYL3zMQ4xNkstO-4Ch/view?usp=sharing .
I have configured extension_dir tp the php/ext folder.
I have similary configured my windows path to the php/ext.
Nothing I try works. Any help is welcome.
Thank you.
Since you're using WAMP, which should include all the pieces you need already working, but also have several PHP versions installed, it sounds like you're installing more than you need which is causing conflicts.
Assume you have no data in your database or web pages that you need to preserve, I suggest removing everything; get rid of WAMP and any extra Apache, PHP, or MySQL/MariaDB installations you have. Clean up (delete or move out of the way) any leftover configuration files, then reinstall WAMP. If you have trouble after installing only WAMP and no other PHP installation, then report back here details of the error. WAMP should come to you working and all ready to go, so if there is a problem, it will be helpful to start from a known base installation without extra configuration files or executable that will cause conflicts.
I'll also point out that the very top of the file you posted states that it's used only for the PHP Command Line Interface, so this is not the configuration file used by anything running through your webserver (like phpMyAdmin or your site). It's a little confusing that there are really two PHP instances (one for the command line and one that runs through the webserver), but in this case you would be looking for the file in wamp/bin/apache/apache2.x.y/bin/php.ini

Installing OpenSIS?

Im using OpenSIS version 5.2. I am trying to install it but after step 2 it just shows a blank box, I cannot proceed to step 3. I have installed this successfully in my other computer but in this one I cannot. They have the same apache, mysql, and PHP version. What should I do?
Thanks in advance.
i hope im not too late. I had the same issue when installing openSis. The third page just loaded blank with no errors. Turns out I am on php 7.0 which dropped all support for php-mysql extension. So i now have to downgrade to php 5.6 or something. Hacked the source a bit and this error gave me a clue:-
An old question but still this problem exists and the solution to that is:
Open the php.ini file in your PHP folder and search for max_execution_time.
When you find it, increase it to 3600 and save the file. Maximum execution time of each script, in seconds, i.e. max_execution_time=3600
Then restart Apache.
Try openSIS installation again.
Basically turned error logging on and it turns out the blank page was caused by the session_state directory not have the correct permissions. That is for my install the PHP.ini file had put it in my documents and settings\local settings\temp\php or something like that. What you need to do is change the directory in the PHP.ini file to point to say c:\temp (make sure it exists!) and set the permission. To fault find grant everyone access to see if it works then work back from there.
The next issue was the install wouldn't connect to my SQL Server express database, so I was madly replacing dll's as per the WIKI!
Turns out though that the SQL Server express install by default doesn't allow named pipes or TCPIP connections hence cannot connect! You need to check this protocols are enabled
To enable TCP/IP:
From the Start menu, choose All Programs, point to Microsoft SQL Server 2005, point to Configuration Tools, and then click SQL Server Configuration Manager.
Optionally, you can open Computer Manager by right-clicking My Computer and choosing Manage. In Computer Management, expand Services and Applications, expand SQL Server Configuration Manager.
Expand SQL Server 2005 Network Configuration, and then click Protocols for InstanceName.
In the list of protocols, right-click the protocol you want to enable, and then click Enable.
The icon for the protocol will change to show that the protocol is enabled.
After this it was smooth. WIKI needs updating badly!

php odbc_connect to mssql works in linux/ubuntu command line not browser

I really feel like I have done an exhaustive search on this matter, found similar issues and have tried a number of things without success, so I am for the first time posting a question here:
I do a lot of web pages/web programming (PHP/jQuery mostly) and host these pages on my digital library department's Drupal/Ubuntu Server. I just code them and post them via Dreamweaver, as I don't have much use for the Drupal front end. I just need the server for my pages.
Anyway, I am wanting to make some PHP pages that can connect to our library catalog, so I have been working from the command line of the Drupal/Ubuntu server. I installed unixODBC, had some troubles, installed FreeTDS, set up the drivers and the DSN.
Finally...
I was able to get a connection to our catalog via tsql and run a query.
I made a basic PHP script to test the connection:
It works from the Ubuntu command line of the server (connection successful).
It doesn't work when I load it in a browser. I get the dreaded:
Warning: odbc_pconnect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /var/www/mydirectory/mytestpage.php on line 15
UPDATE: I installed a test Ubuntu Server in a partition on my laptop, where I started clean, installed Apache2/PHP5(with mssql and odbc modules, etc)/FreeTDS, etc. I got a tsql connection. I made the basic PHP script and ran it successfully from the command line. Then I navigated to the php page from a browser and it worked! I still need to get this to happen on the Drupal server version, but now I have at least narrowed down the issue to something on the Drupal server.
I searched and found such possible causes as:
File permissions, which I think I got corrected, but no go
That maybe I had set up a User DNS and not a System DNS which I tried my best to correct with the proper "odbcinst" command options
That maybe php needs to be running in CGI mode instead of as a module. But that seemed unlikely from what I read. And I am not sure how that would affect Drupal. (There are limits to the system wide changes I should make here.)
A number of people said it was SElinux blocking Apache from displaying the page in the browser, but temporarily disabling SElinux didn't work.
Thanks for any assistance!
Check you have enabled the mssql.so etc at the following location
/etc/php5/apache2/php.ini, you will be having another at /etc/php5/cli/php.ini
in ubuntu php.ini will be maintained separately for cli & mod_php apache configuration
If you are going to test your odbc sources on the commandline, I would advise you use the isql utility instead of tsql. isql uses the DSN you defined in odbc.ini to connect to the database, while tsql connects directly to your database.
If it works with isql, it should work on your webpage as well.
Also check the Drupal/Ubuntu Server files /etc/odbc.ini (your DSN sources) and /etc/odbcinst.ini (TDS Driver settings) to see if they match the ones on the working Ubuntu installation.
My guess is it has something to do with the php. ini file. On my Ubuntu system I've got 2.
One in /etc/php5/apache2/php.ini
And one in /etc/php5/cgi/php.ini
The values in the apache2 path will need to be adjusted to allow the connection. Unfortunately outside of that I'm not too much use as I use MySQL and Mongo
Copy your php.ini from work server to non-work server, add make needed environment variables accessible before starting your web server, and make sure your web-server has full access to your odbc and odbcinst ini-files. And so, using mssql knowledge base or help.

How to run multiple versions of PHP on IIS simultaneously

I have developed a website named vishwasthali.org in PHP and have hosted it in IIS7 on a third-party server. Everything else works fine, except for the code for database access that I have written using MySQLi API. The code works fine on the localhost, but not on the server. Using phpinfo() on the server and my machine, I found that:
(1) On my machine (running in Windows 7 32-bit, Apache hosting environment), the PHP version is 5.3.8, and mysqli version is 5.0.8-dev, and
(2) On the server (running on Windows Server 2008, IIS7 hosting environment), the PHP version is 5.2.14 and mysqli version is 5.0.51a.
Here are the screen shots of phpinfo() on the server:
Here is the sample of the mysqli code.
session_start();
include_once 'code_files/conn.php';
$stmt = $mysqli->prepare('SELECT * FROM adminusers WHERE Username = ? AND `Password` = ?');
$stmt->bind_param('ss', $_POST['Username'], $_POST['Password']);
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows > 0)
........
else
........
Using echo get_class($mysqli); does display mysqli. That means, the code does detect mysqli. But the statement $stmt is not prepared. Even the $mysqli->error; does not display any error, might be because of PHP being running on IIS.
Now I have two options, either change the code for database access to classic mysql API, or to upgrade the PHP and MySQLi versions on the server by downloading latest PHP binaries from the php.net. I won't like to go with the first option (that definitely works), hope you know why. The latter is not in my hands. Can't think anything more than these.
I suppose replacing the php_mysqli.dll on might upgrade the mysqli version, not sure. But what about PHP version?
What can I do in this case. Will an upgrade of PHP and MySQLi versions on the server solve my problem? If YES, can it affect other PHP websites running on the server?
Thanks in advance.
All right. Here's the solution. Different PHP versions can be enabled and running side-by-side in IIS7. Here's the procedure that I have successfully tested on my machine. I am only briefing the process, considering that you are familiar with the IIS and FastCGI. If not, see the link: http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis'
Download any different versions of non-thread safe zip packages with binaries of PHP from http://www.php.net/downloads.php.
Extract them to separate folders in your hard-drive like C:\PHP5.2.14, C:\PHP5.4.3, etc.
Open the php.ini files in all the folders and add/uncomment and change following settings in all of them.
session.save_path = "C:\Windows\Temp"
expose_php = Off
;; Choose any path here, but mostly preferred is this
open_basedir = "C:\inetpub\wwwroot"
extension_dir = "ext"
fastcgi.impersonate = 1
cgi.fix_pathinfo=1
cgi.force_redirect = 0
;; You can chose different time zones for different web-sites
date.timezone = "you time zone"
;; Enable any extensions that you want to per website, e.g.
extension=php_mysql.dll
extension=php_mysqli.dll
Open IIS Manager. Add as many Handler Mappings as the number of PHP versions you want to install. Simply change the path of Executable in the Edit Module Mapping dialog box. Name the Mappings as convenient to identify them easily, like PHP 5.2.14 via FastCGI and PHP 5.4.3 via FastCGI.
In the IIS section in IIS Manager, open FastCGI Settings. Here, check whether there are as many entries as the number of PHP versions you want to run. If not, click Add Applications from the right-pane. Select a php-cgi.exe from the folder of the required PHP version in the Full Path field in the 'Add FastCGI Application' dialog box. Click OK.
Now, copy your website folder to C:\inetpub\wwwroot or whatever path you choose in open_basedir setting in php.ini. In the IIS Manager, expant Sites->Default Web Site from the left pane. Select the website that you want to target to a specific version of PHP.
Open Handler Mapping, with a website selected from the left pane. You will find many mappings here. Look only for those entries that have been created by you (those which have path as *.php). Among them, retain the only one that you need for the particular web-site selected and Remove the others. This WILL NOT delete the mappings from you machine, but only from the web-site selected. You website will now run only on the PHP version whose Mapping you have retained. Do the same for any websites that you want to target to a specific PHP version. You can test it by running phpinfo() in the websites.
After you add new websites to wwwroot, they won't have any handler attached. Add a new handler targetting the desired PHP version. You are done.
This may not be the best procedure. But it worked for me. For verification, see this link:
http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis/#PHP_Versioning'
Hope it helps, in case someone needs this.
Regards
There are a few things quite wrong here!
a) The difference between your development environment and your live site is too large! At least use the same web server and the same PHP 5.x version!
b) NEVER publicly make your phpinfo() accessible, it is a very large security risk! A hacker can get loads of great information from it.
c) Even when using prepared statements you should sanitize your user data before you use it in a query!
I don't think your problem has anything to do with the different mysqli versions. Maybe you should first make sure you use the same web server and php version in both environments and then ask again with more code, (e.g. how you make the connection) if it still doesn't work.
Yes, updating PHP can affect other projects on the server but that just means you need to update these projects, which you should do anyways!
And no, downloading PHP from php.net is not the right way in your case. You should use tested and approved versions provided by the respective repositories.

Xdebug crashes apache

My Xdebug works fine when I use eclipses' internal browser but when I use it in an external browser apache crashes.
I am using xampp and on windows 7 64 bit. If someone needs more information let me know.
For some reason if I have the variables tab open in the php debugger in eclipse it crashes apache. So to stop it I just can't have variables tab open while debugging. So this avoids the problem but doesn't fix it. I would like to be able to have this tab. Any suggestions?
It is possible that the XDebug build and type does not match your apache & php build and type...
Apache compiled with VS.NET 2008 (VC9) for 32bit and using PHP as a module would require XDebug: 32bit, VC9, Thread Safe.
http://xdebug.org/download.php
Also, you could test another WAMP package that comes with XDebug (for example WampDeveloper) and if it also does not work for you, it's probably not a build mismatch issue.
Hey I got this working
Eclipse 3.6.1 (because on later versions key shortcut for putting line comment don't work)
Xampp 1.7.4
Xdebug 2.1.2
The trick is to change php from VC6 to VC9 and then it just works correctly.
BTW. It's the variables panel that causes xdebug to crash apache on php VC6.
Remember to get VC9 version of xdebug for new php AND if you put your new php in directory other than
\xampp\php, then on phpinfo(); you'll see that there's no php.ini loaded so just rename old php (co you can swich them from one to other anytime) and put new php in the same directory in which original php was in "\xampp\php" and copy your php.ini (because paths doesn't change). Also remember to obtain any additional php extensions you've been using in VC9 version for new php and put them in "\xampp\php\ext"
I can confirm most of what t0meck said. Except I've moved up to xampp-win32-1.7.7-VC9 which has PHP 5.38. Taking the phpinfo() results from that to Xdebug's custom installation analyzer, it specifies the php_xdebug-2.1.2-5.3-vc9.dll, but the problem isn't entirely eliminated. As I've documented in my 'notes to self' page, the following is working for me.
After following the above procedure, the 'run as' should work on the first try, but the 'debug as' may crash Apache at every attempt. This is an issue that has driven many people to severe distraction. There is an apparent bug exposed using the debug perspective. At the top center of the perspective is a window with two tabs, the variable view and the breakpoint view. Usually, Apache crashes only when the variable view is highlighted, so highlight the breakpoint view instead. Then set a breakpoint on your project. Now, if you are one of the chosen, you will be able to step through the script using the debugger, but when you switch to the variable view it may still crash Apache. What a drag. Repeat the process and the next time you should actually see the variables and the problem will magically go away, until you restart the project. Just repeat the procedure and be satisfied with being one of the lucky ones.
Don't know if this help, I have same kind of issue, but it relate to array depth xdebug >handle in Variables view. And you can change it. Widnow > Preferences > PHP > Debug > >Installed Debug > Xdebug > Configure enlarge the "Max array depth" solved my issue.
http://bugs.xdebug.org/view.php?id=658#c1767
Just set it to 10 or bigger and it should work

Categories