Make a custom openshift catridge with php7.0 - php

On Openshift there is an oudated version of php therefore I want to make a catridge that is able to run the latest php version in order to run applications that require the latesr version of it.
I also need to have composer intalled too and to be able to connect either with mysql/mariadb or postgresql.
I have seen https://blog.openshift.com/new-openshift-cartridge-format-part-1/ and https://blog.openshift.com/new-openshift-cartridge-format-part-2/ from documentation and I have just made the directory in order to make the compiles.
Also on the example abode does not show HOW to make a catridge when you need to customly compile stuff such as php.
So what I am asking is if I need to compile an x-y application that my application uses such as php7 etc etc how I will do it. Also php7 need to be compiled only once and I am not sure if I put my scripts on ./openshift/build is a good idea.
I also need to be able to manually abb composer and pecl support and to be able to use the existing postgresql and mysql catridges.

Related

I have developed am application using PHP7 but on the server there is PHP5 and we cannot upgrade the PHP there

Please help me, I have developed an application using Yii2 Framework which requires PHP5.6 or greater, and while deployment of the application on the test server I have noticed that on the test server we are using PHP5.5, So please tell me what can I do? The test server is running Ubuntu.
(Minimum requirement of Yii2 is PHP5.6 and we are using PHP5.5)
Thank You.
if I recall correctly, PHP 5.5.X and 5.6.X are not that different. So if you can deploy your application and it runs properly, you should be fine. If you are using composer, it might be harder (or impossible) to spoof your PHP version, though.
My two cents:
You tagged AWS (and therefor probably EC2), so why don't you just update your PHP version? Why don't you run your application on PHP 7.X anyway? It is a great improvement - performance-wise.
You can try a few things...
1) Do you need to have the dev modules from Composer on the test server? If not do a composer install —no-dev
2) Another switch worth trying on the test server is “--ignore-platform-reqs” I don’t recommend it and even though composer install the files the application might not work.
3) If the above isn’t a fix for you, modify your Composer file to put in the constraints of your environments, change your local environment to match the test server, and re-factor the application if necessary. I’d do that instead of rewriting a whole app in Yii1.
You might want to edit your question and add the information about your composer.json file. Do you commit the composer.lock file to source control?
Additionally, not wise for your company to use anything older than PHP 5.6. And PHP 5.6 will have security support ended in Dec 2018. http://php.net/supported-versions.php
Read the following PHP documentation linked below, particularly the backward incompatibility changes and deprecated features. If you use any of those, you need to change your code. If you don't, then you should be fine. You need to test it.
http://php.net/manual/en/migration56.php

PHP Pear -- 'MDB2\Driver\mysql.php' missing

I've inherited a huge project, and I'm having a real time just trying to get the damned thing on its legs. Every time I run the project, amongst all the Strict Standards and Depreciated notices is one error:
Failed opening 'MDB2\Driver\mysql.php' for inclusion
From what I've read, DBMS drivers stopped being included in default Pear installations over five years ago... So how I can fix this so that either it doesn't use mysql.php anymore, or that my Pear installation DOES have it?
According to the Pear website, I just need to type: pear install MDB2_Driver_mysql but I'm wondering if it wouldn't just be better to change the code?
Thanks!
You say the project is huge, so I would suggest you don't rewrite it to use a different DB access library as that could push out your release date quite a bit and instead just install the required MDB2 driver.
To install the mysql driver, just do:
# pear install --alldeps MDB2_Driver_mysql
(and maybe consider using the mysqli driver instead)
If you do decide to migrate the project to use a different library, I'd suggest Doctrine as it is one of the mature DB libraries out there.
It sounds like you are trying to run PHP code written for an older version on a version of PHP that does not like some of the code.
Also see this for some insight on what you actually have to have installed on the PC running wamp in order to actually access a DB2 database. Are you sure you have all of this installed before you try to install via PECL?

Enabling php sysvshm extension without recompiling

I am using a shared host. PHP is compiled with --disable-sysvshm. I get the following error while running a script:
Fatal error: Call to undefined function shm_attach() in ...
Is there any way to enable it without re-compiling php?
There is, but as a regular user, you can't do it. You'll need admin access.
If you have root access, then your package manager should have the extension available if it doesn't come built into PHP. For SuSE, it's looking like a php-sysvshm package would do it. If there's no package, you'll still need to rebuild, but it's doable.
If you don't have the access you'd need to build PHP or install packages, you won't be able to build or install, let alone load, extensions (which are pretty much the only way you can add functionality without replacing your existing PHP). In that case, you'll need to talk to your web host and see if they will install it for you. If they won't, then that's pretty much it.

Is there a way to change config options after compiling software?

I compiled php 5.4, and am trying to get an existing site ported to it. The problem I'm seeing is that I didn't use the --with-pdo-pgsql option when running ./configure, so I can't connect to my db.
I've already compiled it twice, is there a way to update the configuration without rerunning make and make install?
No, because the shared module was not built to begin with. I don't think PHP allows partial compile of modules, but check the makefile for ability to build modules one at a time. There are builds for just about everything out there already, so maybe consider a prebuilt (and pre-patched) version as well?

After compiling PHP from source are the devel libraries still needed?

After compiling PHP from source are the devel libraries still needed?
For example, I am building a newer version of PHP from source than is on our dev servers. I installed alot of [extension i.e. mysql, postgresql, curl, etc]-devel packages in order for the configure from the dev server setup to work. Do i still need these after php has compiled? For example could I make a distro and then distribute the PHP distro to another server without needing these devel dependencies?
I am a bit of a noob to this.
You don't need to ship the devel-libraries.
But my advice is to take some time and learn how the build system of your linux distribution works. And then build a new php package that can be installed by the package manager.
Take a look at how the "original" php packages were built for the distribution. Most likely you can simply copy and edit the existing rule file(s) and then make a new version of that package. This way you take advantage of the dependency mechanisms and the package manager will not remove/overwrite your version so easily when an update shows up in the "official" repositories.

Categories