Is it possible to compile php extension like phalcon without root permissions? - php

I'm just wondering is it possible to compile php extension like phalcon without root privilage?
I'd like to be able to use phalcon on virtual hosting where I have ssh access also gcc and other compilers installed.
Is it possible to compile extension and just apply settings in php.ini? Or php extensions require some special privilages I don't know about?

I would assume you could compile phalcon without root permissions, but you would need root permissions to make the extension available to apache or nginx or whatever your web server is.

Related

What library do I need for 'pg_connect()'?

I'm trying to connect to another database within a wordpress plugin. Inside the main php file, I tried to call 'pg_connect($con_string);' but I now realize that this function is undefined. Is there a library that I need to include somewhere in the directory? Thanks.
This function is in the php-pgsql package or module. Not sure what OS you are on, but on some Linux distributions the package has version-specific naming like php5-pgsql or php7-pgsql so you might need to install the version specific to whatever PHP version you're using. You can use phpinfo() to output information that will help you troubleshooot what is going on, including versions and what packages are enabled.
The package may need to be installed, or it may be installed but disabled. It is enabled by default in PHP >= 5.3.x. If you're finding it is not included by default, you likely either have a very old version of PHP, or one that is custom-configured not to have this package enabled.
If the issue is enabling it, look in the configuration files. On some systems there is a file installed in /etc/php.d/ like 20-pgsql.ini with a line that will enable the extension. In other systems it is in php.ini which is usually somewhere in the /etc directory. Search these files for a line containing the text pgsql and make sure it is enabled. Then restart the web server (or PHP-FPM if you are using that.)
Hopefully this will address the issue.
If you need further help, the official PostgreSQL documentation is a good resource:
https://www.tutorialspoint.com/postgresql/postgresql_php.htm
And beyond that I would recommend a web search including your specific distribution and possibly PHP version, as this will return information with the correct configuration file locations and options.

how do you install PHP libraries on XAMPP?

So I know that to install a PHP librabry usually you install it in the /lib/ folder on the webserver however I can't find a /lib/ folder on XAMPP and I'm trying to install Swiftmailer in XAMPP.
In /php/ext you can drop php extensions, remember to add them to php.ini later in /php/php.ini with the respective configuration.
You can also use PECL.In /php/ext you can drop php extensions, remember to add them to php.ini later in /php/php.ini with the respective configuration. You can also use PECL.
XAMPP is the tools stack that allows you to run PHP applications on an Apache server (Perl and MySQL also). It isn't supposed to keep any kind of library.
I suggest you saving your libraries in your project's folder.
Or in a global folder that you will add to your PHP include path.
The /lib/ folder (at the very least on the Windows version, where I work on a lot) is in the /php/ folder and not in the main / folder!

php SOLR extension is not loaded in wamp

I am trying to configure SOLR on PHP and using WAMP.Added extension in php.ini also pasted the
php_solr.dll in the extension directory.
Unfortunately the extension details is not appearing in my php info.
I am just confused that may be I am missing any configuration step/
Thanks in advance.
If you are using Linux then go to /etc/php5/apache2/conf.d/. If you find another .ini then create a solr.ini file, add the following line and restart the Apache service.
extension=solr.so
See my blog post for more information.
Let me know if you need more help.
I couldn't get that plugin to work and ended up going for solr-php-client from http://code.google.com/p/solr-php-client/
It does everything you need it to and you can include_once it into your scripts and know that you can deploy them on a standard PHP installation.
Installing Solr on Windows with Wamp
Solr is a great tool for full-text searching and more, from Apache Software Foundation. Its based on Apache Lucene search library and extends it. In this post I will let you know how to install Solr on Windows and integrating it with WAMP. Integration with WAMP is not mandatory if you are not using it.
The esyest way to install solr on Windows is to use Solr installer from BitNami. This can be found here http://bitnami.com/stack/solr. Download the installer and run it with administrative rights. Try to keep the installation path simple something like “c:/solr/” will be appropriate.
It will also install an apache server so if you don’t have wamp or apache already install than its super easy, just go with the flow. If you already have wamp installed than make this apache listen on some available port other than 80 (where wamp apache is listening).
Once the setup is complete Solr will be available for use in port selected during setup (see no big deal). Now if you have wamp and you don’t want to have two apache services running do the following steps.
Enable proxy_module and proxy_http_module via wamp menu or directly from apache conf file.
Open httpd.conf file and add following line at the end of the file
Include "c:/solr/apache-solr/conf/solr.conf"
Note that the path here should be correctly pointing to the solr.conf file. Use the path where you installed the Solr.
Now restart the wamp apache via wamp menu. If it starts correctly than its cool, otherwise check if you have correctly enabled the said modules, and path to solr config file.
Now check http://localhost/solr/ this should show the dashboard for solr.
Remember the extra apache service we need to disable it so it does not start automatically as we don’t need it. So goto Control Panel > Administrative Tools > Services , double click “solrApache” service and change its “Startup Type” to “Manual”. Now it will not start once your system is restated.
Happy solr searching

Apache/PHP fails to start on WinXP when activating MySQL extension

I've been incrementally setting up a web server for research and testing purposes. The "server" is running Windows XP and I initially installed Apache Server 2.2 and PHP 5.3. That's been working great for a while. I am now needing to setup MySQL which I downloaded and installed MySQL v5.5. I am able to interact with MySQL via the command-line interface. In the process of setting up phpMyAdmin, I have encountered difficulties getting PHP and Apache to play nice with MySQL. Here's what I've discovered and tried:
In the php.ini file, when I attempt to uncomment either the php_mysql.dll or the php_mysqli.dll extension and restart the Apache server, the server crashes when it starts. The Windows event viewer says Apache failed to start due to "faulting module php5ts.dll".
The extension_dir parameter is set to ".\ext" and the php_mysql.dll and php_mysqli.dll files are in that directory.
I have also tried copying the libmysql.dll file from the lib folder of the MySQL directory to the Windows\System32 directory (with no change in behavior).
I'm at a bit of a loss to figure out what the next step is. Any suggestions?
The extension it's looking for is an extension output by php at compile time based on your configured build options. It is not looking for the header files from mysql itself.
Also, ".\ext" is a relative path that may or may not be valid in your installation. You may need to re-compile php to include mysql and mysqli (you should also compile PDO support) into your php build (Or whatever the windows equivalent of re-compiling is).
Also, you should make extension_dir an absolute path not relative.

install php on server (iis6) when php already exists due to backup exec

I need to install or use php on a windows 2003 server that already has php 5.2.0.0 installed due (I think) to setting up symantec backup exec. I don't want to interfere with backup exec's php.ini settings - and would rather be able to control my own configuration of php.
searching for php shows that php.exe and other php files are currently installed in
c:\program files\symantec\backup exec\
I'm almost certain that installing the current version of php 5.2.8 to c:\php would be disastrous or calamitous in some way.
There is no PHPRC entry in the server properties > environment variables and I'm pretty sure that the php.exe location is not included in the PATH variable. ...unless the actuall install location is different from the c:\program files\symantec\backup exec\ dir.
Any suggestions on how to proceed?
I'm almost certain that installing the current version of php 5.2.8 to c:\php would be disastrous or calamitous in some way.
What makes you say that :) I've run separate PHP versions on the same machine side by side and not run into bother.
AFAIK the Symantec install should not conflict with your own installation, nor should the separate php.ini files conflict with each other.
[Response to comment]
First thing to note is that I have no experience of Backup Exec or what it uses PHP for. I'm guessing it uses it for its own internal stuff and doesn't spread itself over the OS. Test this by searching for php.ini and php DLLs on the file system. I'm betting it's all quite self contained. PHP searches for the config file as noted here: PHP Site . As you note, BE hasn't set the PHPRC variable. Check it hasn't used those Registry entries either. On a different tack, has BE installed an admin site already on IIS? If so, check the IIS Web Service Extensions to make sure it hasn't already registered the PHP ISAPI dll or PHP CGI exe. IF not, I think you should be okay for your new install.
To be on the safe side, do a manual PHP install as illustrated here: PHP Site. That way, you know exactly what you have installed, and can easily remove the files again if they cause a problem. I can't imagine a problem here that would require you to reinstall BE.

Categories